Search

Get Audio Device List

Programming/C# 2017. 12. 27. 11:02 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Get Audio Device List




using System.Management;


        public void getAudioDevice()
        {
            ManagementObjectSearcher objSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_SoundDevice");

            ManagementObjectCollection objCollection = objSearcher.Get();

            foreach (ManagementObject obj in objCollection)
            {
                String str = "";
                foreach (PropertyData property in obj.Properties)
                {
                    str += String.Format("{0}:{1}\n", property.Name, property.Value);
                }
                Console.Out.WriteLine(str + "\n\n");
            }
        }





참조 : https://stackoverflow.com/questions/1525320/how-to-enumerate-audio-out-devices-in-c-sharp

[jsoncpp] getList Names

Programming/C,CPP,CS 2017. 2. 6. 17:07 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


"List" : {

         "value1" : "10.1.1.1",

         "value2" : "0.0.0.0"

      }




위의 경우에서 "10.1.1.1" , "0,0,0,0" 을 얻을 때에는,




for (auto itr : configuration_value.get("List", ""))

{

char* buf = (char*)malloc(BUFSIZE);

try{

sprintf_s(buf, BUFSIZE, "%s", itr.asString().c_str());

}

   }




위의 경우에서 "value1" , "value2" 을 얻을 때에는,



for ( auto const& id : configuration_value.get("List", "").getMemberNames() ) {

std::cout << id << std::endl;

}

MFC Control Color Change

Programming/MFC 2016. 10. 19. 17:20 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

MFC Control Color Change






afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);


 

 

      CBrush m_combo_brush;

      m_combo_brush.CreateSolidBrush(RGB(0, 0, 255)); // Brush 속성을 생성한다.





HBRUSH MyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)

{

      HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);

 

      // TODO:  여기서 DC의 특성을 변경합니다.

 

      switch (nCtlColor) {

           

      case CTLCOLOR_STATIC:

            pDC->SetTextColor(RGB(255, 0, 0));

            pDC->SetBkColor(RGB(0, 0, 0));

            return (HBRUSH)(m_combo_brush);

      case CTLCOLOR_LISTBOX:

            pDC->SetTextColor(RGB(0, 255, 0));

            pDC->SetBkColor(RGB(0, 0, 0));

            return (HBRUSH)(m_combo_brush);

      default:

            break;

      }

      if (pWnd->m_hWnd == GetDlgItem(IDC_SERVERLIST_COMBO)->m_hWnd)

            hbr = HBRUSH(m_combo_brush);

 

      // TODO:  기본값이 적당하지 않으면 다른 브러시를 반환합니다.

      return hbr;

}

 




pDC

자식 창에 대 한 디스플레이 컨텍스트를 포인터를 포함합니다. 일시적일 수 있습니다.

pWnd

컨트롤의 색을 요청에 대 한 포인터를 포함 합니다. 일시적일 수 있습니다.

nCtlColor

컨트롤의 형식을 지정 하는 다음 값 중 하나가 포함 됩니다.

  • CTLCOLOR_BTN 단추 컨트롤

  • CTLCOLOR_DLG 대화 상자

  • CTLCOLOR_EDIT 편집 컨트롤

  • CTLCOLOR_LISTBOX 목록 상자 컨트롤

  • CTLCOLOR_MSGBOX 메시지 상자

  • CTLCOLOR_SCROLLBAR 스크롤 막대 컨트롤

  • CTLCOLOR_STATIC 정적 컨트롤



'Programming > MFC' 카테고리의 다른 글

MFC CWnd Control Border Color Change  (0) 2016.10.20
MFC CheckBox 컨트롤의 현재 상태  (0) 2016.10.19
MFC Bitmap Button  (0) 2016.10.18
MFC Tab Control Color Change #2  (0) 2016.10.18
MFC Tab Control Color Change #1  (1) 2016.10.18
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Get client IP, Location, Address using just JavaScript?





I would use a web service that can return JSON (along with jQuery to make things simpler). Below are all the free active IP lookup services I could find and the information they return. If you know of any more, then please add a comment and I'll update this answer.


db-ip.com

http://api.db-ip.com/addrinfo?api_key=<your_api_key>&addr=<your_ip_address>

Returns:

{
  "address": "116.12.250.1",
  "country": "SG",
  "stateprov": "Central Singapore",
  "city": "Singapore"
}

Limitations:

  • 2,500 requests per hour
  • Doesn't support JSONP callbacks
  • Requires IP address parameter

geobytes.com

$.getJSON('//gd.geobytes.com/GetCityDetails?callback=?', function(data) {
  console.log(JSON.stringify(data, null, 2));
});

Returns:

{
  "geobytesforwarderfor": "",
  "geobytesremoteip": "116.12.250.1",
  "geobytesipaddress": "116.12.250.1",
  "geobytescertainty": "99",
  "geobytesinternet": "SA",
  "geobytescountry": "Saudi Arabia",
  "geobytesregionlocationcode": "SASH",
  "geobytesregion": "Ash Sharqiyah",
  "geobytescode": "SH",
  "geobyteslocationcode": "SASHJUBA",
  "geobytescity": "Jubail",
  "geobytescityid": "13793",
  "geobytesfqcn": "Jubail, SH, Saudi Arabia",
  "geobyteslatitude": "27.004999",
  "geobyteslongitude": "49.660999",
  "geobytescapital": "Riyadh ",
  "geobytestimezone": "+03:00",
  "geobytesnationalitysingular": "Saudi Arabian ",
  "geobytespopulation": "22757092",
  "geobytesnationalityplural": "Saudis",
  "geobytesmapreference": "Middle East ",
  "geobytescurrency": "Saudi Riyal",
  "geobytescurrencycode": "SAR",
  "geobytestitle": "Saudi Arabia"
}

Limitations:

  • 16,384 requests per hour
  • Returns the wrong location (I'm in Singapore, not Saudi Arabia)

geoplugin.com

$.getJSON('//www.geoplugin.net/json.gp?jsoncallback=?', function(data) {
  console.log(JSON.stringify(data, null, 2));
});

Returns:

{
  "geoplugin_request": "116.12.250.1",
  "geoplugin_status": 200,
  "geoplugin_credit": "Some of the returned data includes GeoLite data created by MaxMind, available from <a href=\\'http://www.maxmind.com\\'>http://www.maxmind.com</a>.",
  "geoplugin_city": "Singapore",
  "geoplugin_region": "Singapore (general)",
  "geoplugin_areaCode": "0",
  "geoplugin_dmaCode": "0",
  "geoplugin_countryCode": "SG",
  "geoplugin_countryName": "Singapore",
  "geoplugin_continentCode": "AS",
  "geoplugin_latitude": "1.2931",
  "geoplugin_longitude": "103.855797",
  "geoplugin_regionCode": "00",
  "geoplugin_regionName": "Singapore (general)",
  "geoplugin_currencyCode": "SGD",
  "geoplugin_currencySymbol": "&#36;",
  "geoplugin_currencySymbol_UTF8": "$",
  "geoplugin_currencyConverter": 1.4239
}

Limitations:

  • 120 requests per minute

hackertarget.com

http://api.hackertarget.com/geoip/?q=<your_ip_address>

Returns:

IP Address: 116.12.250.1
Country: SG
State: N/A
City: Singapore
Latitude: 1.293100
Longitude: 103.855797

Limitations:

  • 50 requests per day
  • Only returns plain text
  • Requires IP address parameter

ip-api.com

$.getJSON('//ip-api.com/json?callback=?', function(data) {
  console.log(JSON.stringify(data, null, 2));
});

Returns:

{
  "as": "AS3758 SingNet",
  "city": "Singapore",
  "country": "Singapore",
  "countryCode": "SG",
  "isp": "SingNet Pte Ltd",
  "lat": 1.2931,
  "lon": 103.8558,
  "org": "Singapore Telecommunications",
  "query": "116.12.250.1",
  "region": "",
  "regionName": "",
  "status": "success",
  "timezone": "Asia/Singapore",
  "zip": ""
}

Limitations:

  • 150 requests per minute

ipify.org

$.getJSON('//api.ipify.org?format=jsonp&callback=?', function(data) {
  console.log(JSON.stringify(data, null, 2));
});

Returns:

{
  "ip": "116.12.250.1"
}

Limitations:

  • None (unlimited bandwidth)

ipinfo.io

$.getJSON('//ipinfo.io/', function(data) {
  console.log(JSON.stringify(data, null, 2));
});

Returns:

{
  "ip": "116.12.250.1",
  "hostname": "No Hostname",
  "city": "Singapore",
  "region": "",
  "country": "SG",
  "loc": "1.2931,103.8558",
  "org": "AS3758 SingNet"
}

Limitations:

  • 1,000 requests per day

ipinfodb.com

$.getJSON('//api.ipinfodb.com/v3/ip-city/?key=<your_api_key>&format=json&callback=?', function(data) {
  console.log(JSON.stringify(data, null, 2));
});

Returns:

{
  "statusCode": "OK",
  "statusMessage": "",
  "ipAddress": "116.12.250.1",
  "countryCode": "SG",
  "countryName": "Singapore",
  "regionName": "Singapore",
  "cityName": "Singapore",
  "zipCode": "048941",
  "latitude": "1.28967",
  "longitude": "103.85",
  "timeZone": "+08:00"
}

Limitations:

  • Two requests per second
  • Requires registration to get your API key

ip-json

http://ip-json.rhcloud.com/json

Returns:

{
  "site": "http://ip-json.rhcloud.com",
  "city": "Singapore",
  "region_name": null,
  "region": "00",
  "area_code": 0,
  "time_zone": "Asia/Singapore",
  "longitude": 103.85579681396484,
  "metro_code": 0,
  "country_code3": "SGP",
  "latitude": 1.2930999994277954,
  "postal_code": null,
  "dma_code": 0,
  "country_code": "SG",
  "country_name": "Singapore",
  "q": "116.12.250.1"
}

Limitations:

  • Quota not stated, but may be limited by OpenShift PaaS
  • Doesn't support JSONP callbacks

jsonip.com

$.getJSON('//jsonip.com/?callback=?', function(data) {
  console.log(JSON.stringify(data, null, 2));
});

Returns:

{
  "ip": "116.12.250.1",
  "about": "/about",
  "Pro!": "http://getjsonip.com"
}

Limitations:

  • None (unlimited bandwidth)

jsontest.com

$.getJSON('//ip.jsontest.com/?callback=?', function(data) {
  console.log(JSON.stringify(data, null, 2));
});

Returns:

{
  "ip": "116.12.250.1"
}

Limitations:

  • Goes down a lot (over quota), so I wouldn't use it for production

snoopi.io

http://api.snoopi.io/v1/

Returns:

{
  "remote_address": "116.12.250.1",
  "requested_address": "116.12.250.1",
  "requested_time": "11:25:35 pm",
  "requested_date": "January 31, 2016",
  "CountryCode": "SG",
  "Region": null,
  "Region_Full": "Singapore",
  "City": "Ubi",
  "PostalZip": "96940",
  "TimeZone_Name": "Asia\/Singapore",
  "Latitude": "1.31865",
  "Longitude": "103.894"
}

Limitations:

  • 2,500 requests per day
  • Doesn't support JSONP callbacks


'Programming > JAVA,JSP' 카테고리의 다른 글

Java Applet 설정  (0) 2017.02.28
Java SocketServer control Image, DBConnect, String  (1) 2016.10.28
Web Browser 점유율 통계  (0) 2016.04.18
Activex Event use in JavaScript  (0) 2016.04.14
JDBC Realm  (1) 2016.03.09