Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

Matthew Devine

@Matthew Devine
About
Posts
15
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How do I read a particular registry key
    M Matthew Devine

    Yeah that's exactly right, that's what I'm seeing HKEY hKeyRoot,hKeyNew; LPCTSTR lpSubKey; LPTSTR Value; DWORD retcode; DWORD Value_type; DWORD Value_data; DWORD Value_size; hKeyRoot = HKEY_CURRENT_USER; lpSubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"; Value = "ProxyEnable"; retcode = RegOpenKeyEx ( hKeyRoot, lpSubKey, 0, KEY_QUERY_VALUE, &hKeyNew ); if (retcode != ERROR_SUCCESS) MessageBox("Error opening key",_T("NO")); retcode = RegQueryValueEx ( hKeyNew, // HKEY (hkey) handle of key to query Value, // LPSTR (lpValueName) address of name of value to query NULL, // LPDWORD (lpReserved) reserved &Value_type, // LPDWORD (lpType) address of buffer for value type (BYTE *) &Value_data,// LPBYTE (lpData) address of data buffer &Value_size // LPDWORD (lpcbData) address of data buffer size ); if (retcode != ERROR_SUCCESS) MessageBox("Error reading key",_T("NO")); else fout<<"Registry Value - "<

    C / C++ / MFC windows-admin tutorial question

  • How do I read a particular registry key
    M Matthew Devine

    The issue I seem to be having is that ProxyEnable is actually a Reg_DWORD key, so I don't think I'm reading it in correctly and I'm not sure how to verify that its actually an enabled key. Basically if I were to get a value back from doing a query on that key, what do I compare its value to?

    C / C++ / MFC windows-admin tutorial question

  • How do I read a particular registry key
    M Matthew Devine

    Hi Everyone, I want to be able to read the Registry "ProxyEnable" located within HKEY_CURRENT_USER and located at the following path Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings. What I want to be able to do is tell whether "ProxyEnable" is on or off. Not quite sure how to do that particular piece though. Thanks in advance, Matt

    C / C++ / MFC windows-admin tutorial question

  • Problem changing proxy with custom IE toolbar
    M Matthew Devine

    Well I'm having some trouble checking the registry key setting for "ProxyEnable", I can't seem to get it to work. I'm also not to sure about getting a DWORD value from the registry, but I'll let you know if I figure it out.

    C / C++ / MFC help sysadmin windows-admin tools

  • Get Value From Registry Key
    M Matthew Devine

    I was trying to now look up the registry key value of ProxyEnable: This is located in "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", I was trying to edit your code to work with the fact that this is a DWORD. But I can't seem to get it to work, what I want to do is query the value of that key. After I have the value I just want to write a simple if-statement that will execute ProxyOn() method if the Proxy is seen as being enabled and a ProxyOff() method if the proxy is disabled. Any assistance would be greatly appreciated.

    C / C++ / MFC windows-admin

  • Problem changing proxy with custom IE toolbar
    M Matthew Devine

    Jose Lamas Rios wrote: Have you tried reading the "ProxyEnabled" (I guess that's the one) value in the key you are monitoring instead of using InternetGetConnectedState? I was also wondering why the code I posted before was acting that way. I'm just assuming I'm not seeing the problem because I put it together.

    C / C++ / MFC help sysadmin windows-admin tools

  • Problem changing proxy with custom IE toolbar
    M Matthew Devine

    When I execute the following code in my program, it works fine when I toggle the buttons that I generated. However, if I go into IE and manually set the proxy via Tools -> Internet Options -> Connections -> Lan Settings -> Check/Uncheck "Use a Proxy setting...", it works the first time and runs the correct method, so if I check the box and turn the proxy server on and click Ok it will run the ProxyOn() method. However if I don't compeletly close out Internet Options and and go back into Lan Settings and uncheck the box and click OK, it will run the ProxyOn() method again. Now the really confusing part is the fact that if I do it a third time or more, it won't double run the methods but it will be one off from what it should be running. I know its alot to digest but does anybody have any ideas. So here I have the thread that I create to watch for a change in the proxy setting. hThread = CreateThread (NULL, 0, (unsigned long (__stdcall *)(void *))this->ThreadFunc, (void *)(this), 0, &this->hThreadId); DWORD WINAPI CMFToolbar::ThreadFunc(LPVOID lParam) { CMFToolbar *toolbar = (CMFToolbar*)lParam; while(1){toolbar ->WINAPI_tWinMain();}; } int CMFToolbar::WINAPI_tWinMain() { LONG l = 0L; HKEY hKey = {0}; //Open Registry Key to watch l = RegOpenKeyEx ( HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), 0, KEY_NOTIFY, &hKey ); if(l == ERROR_SUCCESS) { // The following call will wait until a change is made to the registry key. l = RegNotifyChangeKeyValue ( hKey, FALSE, REG_NOTIFY_CHANGE_LAST_SET, NULL, FALSE ); RegCloseKey(hKey); //Determines whether or not Proxy is enabled and executes proper method DWORD flag = 0; if ( InternetGetConnectedState ( &flag, 0 ) ) { if ( flag & INTERNET_CONNECTION_PROXY ) { fout<<"Proxy Off Method"<

    C / C++ / MFC help sysadmin windows-admin tools

  • Get Value From Registry Key
    M Matthew Devine

    Thanks alot for the help, I was able to implement your code perfectly Alok. Again much appreciated.

    C / C++ / MFC windows-admin

  • Get Value From Registry Key
    M Matthew Devine

    Would this correctly output the value located in said key, with the name of "home" into the variable value that I've defined. char* value = NULL; LONG l = 0L; HKEY hKey = {0}; l = RegOpenKeyEx ( HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\Test"), 0, KEY_NOTIFY, &hKey ); if(l == ERROR_SUCCESS) { // The following call will wait until a change is made to the registry key. l = RegQueryValueEx( hKey, TEXT("home"), NULL, NULL, value); RegCloseKey(hKey);

    C / C++ / MFC windows-admin

  • Get Value From Registry Key
    M Matthew Devine

    Alright lets say I want to get the value from a particular registry key. How would I go about programming that to actually accomplish this feat. Key: HKEY_CURRENT_USER\Software\Microsoft\Windows\Test Name: home value: testvalue

    C / C++ / MFC windows-admin

  • Kinda new...need help
    M Matthew Devine

    Alright I'm alittle new to this whole business and was wondering if I could get some help adding code to an existing project. I already have most of the code that needs to be added I'm just not quite sure what specifics need to be edited. void CMFToolbar::SetOpenLoadProxy() { const char* conn_name="DefaultConnectionSettings"; const char* proxy_full_addr = "localhost:5115"; INTERNET_PER_CONN_OPTION_LIST list; DWORD flag ; if ( InternetGetConnectedState ( &flag, NULL ) ) { if ( flag & INTERNET_CONNECTION_PROXY ) { SetDefaultProxy(); }else { DWORD dwBufSize = sizeof(list); // Fill out list struct. list.dwSize = sizeof(list); // NULL == LAN, otherwise connectoid name. list.pszConnection = (LPTSTR)conn_name; // Set three options. list.dwOptionCount = 3; list.pOptions = new INTERNET_PER_CONN_OPTION[3]; // Make sure the memory was allocated. if(NULL == list.pOptions) { // Return FALSE if the memory wasn't allocated. OutputDebugString("failed to allocat memory in SetConnectionOptions()"); } // Set flags. list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS; list.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT | PROXY_TYPE_PROXY; // Set proxy name. list.pOptions[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER; list.pOptions[1].Value.pszValue = (LPTSTR)proxy_full_addr;//"http://proxy:80"; // Set proxy override. list.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS; list.pOptions[2].Value.pszValue = "localhost; 127.0.0.1"; // Set the options on the connection. InternetSetOption(NULL,INTERNET_OPTION_PER_CONNECTION_OPTION, &list, dwBufSize); // Free the allocated memory. delete [] list.pOptions; InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0); InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0); } } The following code is code I was given that will apparently scan a properties file for two specific fields. I know I need to add the code to open the file but I'm not sure what I would need to do after that? char* whitespace_ltrim(char * pszSource) { char* cp = pszSource; if (cp && *cp) { while (isspace(*cp)) ++cp; if (cp != pszSource) memcpy(pszSource, cp, (strlen(cp)+1)*sizeof(char)); } return pszSource; } char* whitespace_rtrim(char* pszSource) { char* cp = pszSource; if (cp && *cp) { int bNonSpaceSeen = 0; /* check if

    C / C++ / MFC business performance help question

  • Registry Notifier into a deskband?
    M Matthew Devine

    So you are saying I should call create thread from where I load the DLL file? And this will in turn always be activated, thus responding everytime the said regirsty key is changed. I'm alittle new at programming C++, sorry. Appreciate the help.

    C / C++ / MFC help windows-admin tutorial question

  • Registry Notifier into a deskband?
    M Matthew Devine

    Alright I got the following code from on here to be able to notify when a registry key has been modified. The only problem is, I can't figure out how to implement this code into the DLL that I'm creating that will be used in an IE deskband. The problem I'm running into is that if I make it sychronous it will noticebly hang in IE while it waits for the Reg Key to change. Any ideas wouldn't be helpful. #include <tchar.h> #include <windows.h> INT WINAPI _tWinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nCmdShow ) { LONG l = 0L; HKEY hKey = {0}; l = RegOpenKeyEx ( HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), 0, KEY_NOTIFY, &hKey ); if(l == ERROR_SUCCESS) { // The following call will wait until a change is made to the registry key. l = RegNotifyChangeKeyValue ( hKey, FALSE, REG_NOTIFY_CHANGE_LAST_SET, NULL, FALSE ); MessageBox(NULL, _T("Registry key changed"), _T("Registry key changed"), 0); RegCloseKey(hKey); } return 0; }

    C / C++ / MFC help windows-admin tutorial question

  • IE Proxy Switcher Deskband
    M Matthew Devine

    Thanks for pointing me in the right direction Gerald. but I can't quite seem to figure out how to exactly write something that would actively monitor for a change in this registry key. Any help with this would be greatly appreciated. I'm not an expert developer so you'll have to bear with me.

    C / C++ / MFC tools help announcement

  • IE Proxy Switcher Deskband
    M Matthew Devine

    I am currently developing a little IE deskband that gives the user the ability to hotswap between proxy settings with the click of a button, the button then changes to the user knows what the current proxy setting is(Green Means Proxy On|Red Means Proxy off). The one problem I am running into is the fact that it is able to determine the proxy setting when I start IE and thus the button is correctly set, but if I manually change the proxy through IE via Tools -> Internet Options -> Connection Tab -> Lan Settings, the button doesn't update. I was wondering if there is anyway I could envoke a ilstener that would be able to notice when I manaully change the proxy and then set the button based on its current setting after said event. Might be a difficult explanation to understand but if anybody is interested please e-mail me if you want further explanation.

    C / C++ / MFC tools help announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups