Windows Programming - Misc information Ive found useful over the years. |
| Sunday, 27 March 2005 01:00 | |||
ODBC and DSNI have noticed that sometimes the "ODBC Data Source Administrator" doesn't show system DSNs that exist in the system. As in, sometimes a custom program will be able to connect, but other tools can't see/use that DSN. I have found that it is the result of missing entries in the registry. If you look in HKLM\SOFTWARE\ODBC\ODBC.INI you will see all your DSN info as hives underneath. HKLM\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources show also have an entry for each one of those DSN entries. However, for some unknown reason, the entries don't exist. Fix em in regedit and it'll show up and work again!Hey, Scripting Guy! Can I Create and Delete a DSN Using a Script? How to Create ODBC DSN on multiple SQL server machines Microsoft SQL Server 2005 Books Online Reading proxy settings from IEThere have been times when I'm using the libcurl library or even my own socket code and I need to get the proxy information from the OS. This little snippet can be used to pull the proxy information from the registry. (The proxy information is set in the IE connections tab)Use this function to grab the proxy value and pass it on to libcurl or whatever. #ifdef WIN32 #include <tchar.h> // for the unicode _T() macros char *GetMSRegistryProxy(char *dest, int len) { DWORD type, bufsize=20; char buf[20]; HKEY subkey; long ret; dest[0]='\0'; ret = RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), 0,KEY_QUERY_VALUE, &subkey); if(ret == ERROR_SUCCESS) { ret = RegQueryValueEx(subkey, _T("ProxyEnable"), NULL, &type, (LPBYTE)buf, &bufsize); if(ret == ERROR_SUCCESS) { if(*buf!=0) { ret = RegQueryValueEx(subkey, _T("ProxyServer"), NULL, &type, (LPBYTE)dest, (LPDWORD)&len); } } RegCloseKey( subkey ); } return dest; } #endif ActiveX controlsI've done a lot of COM/ActiveX development over the years. This is just a little information I found handy when dealing with ActiveX controls.All WebBrowser Interfaces This interface is used if you want to find things like when the Navigate2 is fired or when the window is closing. DWebBrowserEvents2 Interface If you want events for the page itself, you have to sink up with the HTMLWindowEvents interface. HTMLWindowEvents Dispinterface In order to establish the event sink, you need to: 1) Get the top-level IWebBrowser2 reference from your activeX control Q257717 HOWTO: Retrieve Top-Level IWebBrowser2 Interface from ActiveX 2) Follow the instructions in the following article to establish the sink: HOWTO: Create a Sink Interface in MFC-Based COM Client Note: When you call AfxConnectionAdvise, pass in the the IWebBrowser2 reference for the first parameter. Here is some additional information specific to handling events from an ActiveX control Handling HTML Element Events Q167230 HOWTO: Detect When Internet Explorer Holds Controls and Pages in Memory WTL Developer Guide AtlServer PRB: Error C2787 When Building a Project Using ATL 3.0 Windows Template Library - Wikipedia, the free encyclopedia SourceForge.net: Windows Template Library (WTL) Platform SDK / Windows SDKThe windows SDK now supersedes the platform SDK. It is a NO-NO to have both the Windows SDK and the platform SDK installed. There are some other gotchas too...Re: missing winable.h - MSDN Forums Download details: Microsoft Windows 7 SDK - The Windows SDK for Windows 7 and .NET Framework 3.5 SP1 provides documentation, samples, header files, libraries, and tools designed to help you develop Windows applications using both native (Win32®) and managed (.NET Framework) technologies. Device Development Kit (DDK)To build within the windows DDK, create two shortcuts with the following targets. (This assumes WIN2003 SP1 DDK)%windir%\system32\cmd.exe /k C:\WINDDK\3790.1830\bin\setenv.bat C:\WINDDK\3790.1830 checked %windir%\system32\cmd.exe /k C:\WINDDK\3790.1830\bin\setenv.bat C:\WINDDK\3790.1830 freeThe free and checked env. correspond to release/debug as in normal development environments. To build the samples and code, you'll need to run the command "build" from the cmd. Winsock and header madness.When developing with sockets, I've found that order and multiple definitions get hairy. Apparently, you can't include winsock.h and winsock2.h at the same time. Tracking down these issues is VERY hard.If you have errors like "'AF_IPX' : macro redefinition" or other nonsense like "'fopen' : is not a member of '`global namespace''" It could be winsock issues. It looks like the suggested practice is to include winsock before windows.h otherwise you'll get nonsense. #ifdef WIN32 #include <winsock2.h> #include <Windows.h> #endif Remote desktop notesThere is a lot of good information available from the function GetSystemMetrics, like screen size, if it's a remote desktop session, or the number of displays. Useful.GetSystemMetrics Function (Windows) Optimizing Visual Studio 2010 and WPF applications for Remote Desktop - WPF Performance and .NET Framework Client Profile - Site Home - MSDN Blogs win32 sidenotesThe Old New Thing : BOOL vs. VARIANT_BOOL vs. BOOLEAN vs. boolMicrosoft SDKs - a huge list of SDKs.
|
|||
| Last Updated on Sunday, 27 November 2011 21:39 |

