macro FARPROC

589 byte By raw_recruit at 2007-11-20 9:51:09
macro FARPROC is defined: typedef int (FAR WINAPI *FARPROC)(); typedef.hWhy following code not display address of ZwQuerySystemInformation:#include <stdio.h>#include <windows.h>int main( ){ FARPROC pZw = NULL; HMODULE hNTDLL = GetModuleHandle(TEXT("ntdll.dll")); printf( "ntdll.d...

reaching the files of directories under a root directory

623 byte By kkirtac at 2007-11-20 9:51:15
Hello, i m in a Win32 Console application and i got stuck with this problem,i will simply state the algorithm of the problem : root "r" = GetRootDirectory( ); foreach child directory "c" of "r" foreach file "f" of "c" process f ; endfor endforAnd i w...

Dialog box focus given to a static control

918 byte By wejrepus at 2007-11-20 9:51:19
I'm trying to make a small popup dialog box with only one control in it- a piece of text asking the user to press a key they would like to have associated with a certain action.What i've done is a modal dialog box that tries to catch keyboard messages. However, no input is getting to my di...

return value CoCreateInstance not documented in MSDN

1033 byte By George2 at 2007-11-20 9:52:04
Hello everyone,The return value of CoCreateInstance is -2146232576, which is un-documented in MSDN. http://msdn2.microsoft.com/en-us/library/ms686615.aspxWhat does it mean? What is wrong with my code?HRESULT hr = CoCreateInstance(CLSID_MyDriver, NULL, CLSCTX_INPROC_SERVER, IID_IMyDriver, rein...

Knowing when a ShellExecute App Finishes

670 byte By mjl_1000 at 2007-11-20 9:52:45
Hi:I am calling a file zip utility using ShellExecute() in MSVC++, and need a way to figure out when its completed zipping up the files I've asked it to. I would greatly appreciate any guidance on how to do this. The context of the MSVC++ help is too unfamiliar to me to figure out where to ev...

static member variable, dll export and multiple translation units

1594 byte By THY02K at 2007-11-20 9:52:50
Here's a problem with static class member:From DLL A - header:class __declspec(dllexport) CLogEntry{public:...static CLog* GetSingletonLoggingProvider() { return s_pSingletonLoggingProvider; }...protected:...static CLog * s_pSingletonLoggingProvider;};.cpp file:#include "stdafx.h"#include "LogE...

exe work but dll does not work?

452 byte By George2 at 2007-11-20 9:53:05
Hello everyone,I have written two simple programs (source codes are the same),1. In an exe, loading a class from another COM component by invoking CoCreateInstance;2. In a COM DLL, loading a class from another COM component by invoking CoCreateInstance;1 success but 2 fails. I am running in the same...

GroupBox Control

362 byte By rutu at 2007-11-20 9:53:31
Hi,This is the code i am using to create a grooup box at run time. m_pButton.Create(_T(""),WS_CHILD /*| WS_VISIBLE */| BS_GROUPBOX,CRect(14,445,302,630),&m_wndDlgBar,IDC_GRAPHIC_OBJECT);Its working perfect. But how can i put controls in to this group box dynamicaly. I want to put two edit box in t...

sdk error

13919 byte By amir_civil at 2007-11-20 9:53:39
hi i installed windows sdk platform whit visual c++ 2008i improve the compiler following this code Step 3: Update the Visual C++ directories in the Projects and Solutions section in the Options dialog box. Add the paths to the appropriate subsection:Executable files: C:\Program Files\Microsoft Platf...

difference between win32 and console programming

192 byte By vertex78 at 2007-11-20 9:53:50
I use devC++ to program in and when you start a new project you can choose from windows program or console program. I am curious as to what kind of settings are being changed between the two.

MFC, observing a file on harddisk

875 byte By Fatboy at 2007-11-20 9:54:01
I wonder if the following is feasible in MFC or WIN32. I would like to read a file on hard disk, which I can do. Call that file fish.dat The catch is, I'd like to read it when and only when the file is changed, by a user or by another application. Is that feasible? I was thinking that may...

OpenProcess - Access restrictions

360 byte By DaAvange at 2007-11-20 9:54:29
Hello!How can I use open process or Tool help snapshoot, to get every proccess information, because now on some I get access denied because of security restrictions (So say microsoft in their examples)So the question is how to bypass the restrictions or elevate my process privileges so I can view ev...

Adding a button to listview

101 byte By Payne at 2007-11-20 9:54:33
How can I put a simple pushbutton into a listview item so that the cell is essentially just a button?

Setting memory read only

229 byte By DaAvange at 2007-11-20 9:55:28
Hello <br/>I would like to know how to set my program's memory to read only to stop other programs injecting code (DLL injections, Memory writings, CreateRemoteThread) to my program so they won't alter its process.

Process Termination & Sockets

2201 byte By frerich at 2007-11-20 9:55:32
Hi,in my project, I needed to inject some code into a foreign process. This was realized by hooking a DLL into the given process which is executed as the process starts (I believe the DllMain function of my hook DLL is called before the WinMain function of the process I'm hooking into, but I�...

ServProv.h problem for first time Win32 API user

1078 byte By inbugable at 2007-11-20 9:55:45
Hello chaps.I decided to have a go at using the Win API. Long time C++ coder, first time coding the Win API. I banged out some lines.#include <windows.h>int main (void){ return 0;}Result: No dice. An error tucked away in ServProv.h, apparently. Seemed odd, so I wrote this:#include <ServP...

icon doesnt work

899 byte By nerdykid at 2007-11-20 9:56:17
when i compile this, i get an error saying i cant convert thingsthe entire error is shown as a comment HMENU hMenu, hSubMenu; HICON hIcon, hIconSm; hIcon = LoadImage(NULL, "menu_one.ico", IMAGE_ICON, 32, 32, 0); //cannot convert void * to HICON_* in function _stdcall WndProc(HWND...

Need help to pass VARIANT of references

2275 byte By riteshtonk at 2007-11-20 9:56:54
Hi,I have a COM+ Dll which exposes a method :getData(SAFEARRAY** myVariant);The function basically fires a query to DB and puts the record in the myVariant pointer (out parameter)myVariant contains SAFEARRAY of myUDT which contain BSTRs.struct MyUDT{ BSTR name; BSTR value;};Hence myVariant.vt...

An error compiling a static function

601 byte By amore at 2007-11-20 9:57:11
Hi here,I have a static function which give me a error in the main.ccp below.The error says: "undefined reference to `CMedico::numPeriodos()'"These are my files:////////// CMedico.h ///////////class CMedico{//...static int numPeriodos();//...};////////// CMedico.cpp ///////////int CMedico::num...

ReadFile

3073 byte By gabirata at 2007-11-20 9:57:13
I'm trying to read the entire disk drive.So I used the following code:BOOL GetDriveGeometry(DISK_GEOMETRY *pdg, HANDLE hDevice){ BOOL bResult; // results flag DWORD junk; // discard results bResult = DeviceIoControl(hDevice, // device to be queried...

Problem with CreateFont() function in my Method

701 byte By messycan at 2007-11-20 9:57:16
in the MSDN, it states that the lpszFace is a pointer to a null-terminated string of the font name. I am passing that to my method, and it does not select the font. If I go into my method and change it to "Verdana", it works just fine. I have searched, and have not found a solution. Im pretty su...

Reg_binary

679 byte By Cyber1990 at 2007-11-20 9:57:19
Hello.Im working on a registry editing tool and i have a small problem. I can't figure out how to create a REG_BINARY file in the registry using RegSetValueEx.I figured out how to create a DWORD file using this function. this is an example of what i did:HKEY hKey;DWORD value = 1;RegOpenKeyEx(HK...

Problems with VT_BYREF and VARIANTS

2204 byte By riteshtonk at 2007-11-20 9:57:22
Hi,I have a method inside a COM+ DLL which I invoke from a C++ application.This is a stripped down version of the code.The parameter repeatData is an out parameter which is an array of structures.The VARIANT in the structure contains a SAFEARRAY of BSTRs.typedef _BstrStruct{ int i; VARIANT nam...

Adding Text To Rich Edit Control Efficiently

1312 byte By RichardC at 2007-11-20 9:57:31
I wrote a Rich Edit Control based log class to display a text log with some colour highlighting of numbers and certain words. Text is added in blocks by its colour using the below function:void CBoxLog::appendTextToLog(char* szText){ // Append new text at end of log int iOriginalLength = GetWindowT...

AssignProcessToJobObject on Windows Vista

3279 byte By frerich at 2007-11-20 9:58:39
Hi,in one of my programs, I spawn a few child processes. Since I'd like to treat my process and the child processes, I've been using job objects: the first (the "wrapper") process creates a job object, assigns itself to the object, and then all children end up in that job object as well. T...

Switching Primary Monitor Problem

715 byte By Josh Mackey at 2007-11-20 9:59:12
Hey all, I have been working with this problem for a few days.I want to be able to run my program, and it will make my secondary monitor the primary monitor, and then switch it back when run again.From what I read, my code SHOULD work but it does not.I am trying to use the ChangeDisplaySettingsEx fu...

WriteFile and fwrite

794 byte By George2 at 2007-11-20 9:59:24
Hello everyone,I think there is a in-place re-write function which WriteFile supports, but fwrite does not support. http://msdn2.microsoft.com/en-us/library/aa365747.aspxSuppose I have a file, and the content is "foo is content", I want to change the content of the file to "goo is content".If I am us...

A Couple Questions

903 byte By ldb88 at 2007-11-20 10:00:15
Sorry to bother everyone with this, but I have a few questions.1. Calling LockSetForegroundWindow gives an identifier not found error at compile time on VS2005. I have included <windows.h>. Why does it do this? How do I fix it?2. How do you get the handle of a window if you only know part...

C++ stack trace after a crash

3904 byte By Zaccheus at 2007-11-20 10:00:52
I recently learned that it is possible to do a stack trace using the StackWalk64 function.I've written a function which returns an std::vector<void*> which represents the stack trace - i.e. each element represents the return address of a function call. Using the associated PDB files it is...

FindWindow Question...

978 byte By DaAvange at 2007-11-20 10:01:07
Hi there,I'm tring to find out how FindWindow finds windows.There is two diffrent programs running:1) Which I don't have access to source code and has a window called "GCExplorer" registered with some constant class name.2) My test program which creates a window with the same window name...

making a clock in win32

734 byte By g3RC4n at 2007-11-20 10:01:23
whats the best way to make a clock (in win32)? bearing in mind i'm not up to multi-threaing level win32 programmingthis is what i first came up with int cur_time = time(NULL); int dif_time = 0; while (GetMessage (&messages, NULL, 0, 0)) { //once a second send WM_PAINT message...

Toolbars in Vista - Dropdown Problem

2128 byte By Blobmiester at 2007-11-20 10:01:28
Okay... in windows vista I cannot seem to get the dropdown button to display correctly.I apply the styles that are neccesary... if i do not set TBSTYLE_EX_DRAWDDOWN, then it works perfect. Yet without that flag I do not get the little arrow on the side - aka spilt-button effect.When that flag is set...

How to prevent the "Show Desktop" from minimizing my window?

424 byte By Kansana at 2007-11-20 10:02:35
Hi,My requirement is that my application's window should not get minimized even on clicking the "Show Desktop" in quick Launch. Is there a way to handle this?I tried handling the WM_WINDOWPOSCHANGING and tried to set the WINDOWPOS structure's flag to SWP_SHOWWINDOW but still the window got...

problem with HrESEBackupRestoreGetNodes

359 byte By _hunter at 2007-11-20 10:02:45
Greetings...There is some problems with calling this function:When first parameter is NULL (MSDN says that it is normal) -- this function returns error code == 5 (access denied). When I pass full computer name -- this function throws exception "The RPC server is unavailable"So how to call this funct...

How to detect a mouse click on the balloon tooltip?

484 byte By dc_2000 at 2007-11-20 10:04:08
Hi all:It seems like a simple task. I have an XP style balloon tooltip that I created myself using CreateWindowEx() API. I need to trap a notification when user clicks on the body of that balloon. I thought it would be trapping a simple WM_LBUTTONDOWN message but that message is also sent if a user...

to access the printer name in visual c++

1243 byte By RAJEEV VERMA at 2007-11-20 10:04:11
FROM LAST 2 DAYS ,I AM TRYING TO ACCESS THE PRINTERNAME WITH THE VISUAL C++ FUNCTION Getprinter,openprinter and at Printer_Info_2 level. I am putting my code ,plz help me out & tell me my it is not working:PRINTER_INFO_2 *pPrinterInfo ;if(OpenPrinter("HP LaserJet 3200 Series PS",&hprinter,NULL)==0){...

esebcli2. how to get databases files.

900 byte By _hunter at 2007-11-20 10:04:14
Greetings...I'm working with functions from esebcli2.dll and there is one problem:MSDN says that DATABASE_BACKUP_INFO structure defined as:typedef struct { wchar **wszDatabaseStreams; wchar **wszDatabaseDisplayName; GUID *rguidDatabase; unsigned long *rgIconIndexDatabase;} DATABASE_...

Is there any way CancelIo-API does work against ReadFile(Ex)-API on diskfile?

903 byte By skylark at 2007-11-20 10:04:19
Hi, everyone.I want to make sure CancelIo-API does work for ReadFile or ReadFileEx, through a driver works as if it not existed.MSDN says: --To cancel all pending asynchronous I/O operations, use either: CancelIothis function only cancels operations issued by the calling thread for the specified fil...

Make an existing window child of another window

259 byte By bidesh at 2007-11-20 10:04:27
Hi all,<br/>I have a window which is created in a dll. i get the handle of the window. what i want to make this window a child of another window.<br/>Can i do this if yes then how.<br/>please tell me the procedure...<br/>thanks <br/>Bidesh

[RESOLVED] What Database should I use?

673 byte By reeksy at 2007-11-20 10:04:29
Hi Im new to VS and C++. Ive recently installed VS2005 Express and (with the help of other code guru forum members) integrated win32 into it. I now want to make a connection to a database.The ultimate goal of my C++ application is to create a series of forms (within windows) allowing the end-user to...

Win32 CreateProcess Help

142 byte By techie_girl at 2007-11-20 10:04:30
Hi 2 all :)<br/>Please help me with this code:<br/>Please tell me the solution as to how to fix it.<br/>Thanks<br/>~Techie Gal

get current windows partition name

185 byte By lopez86100 at 2007-11-20 10:04:38
HI ! <br/>How can I get partition name on which is current user's windows running.<br/>I need it cause I want to go to documents and settings and then configure browsers.

bitmaps and dialogs

311 byte By gamer150 at 2007-11-20 10:04:41
1. Can someone please tell me how to save a bitmap from a HDC!2. How would you make a dialog that is a child window of another window with two text boxes and a button on it, so that when the button is clicked the dialog box closes and the value of the two text boxes are stored in two variables?:sick...

MDI doesnt close

2706 byte By C#er at 2007-11-20 10:04:50
Hi for allI'm developing a single MDI app. I have the following matter:When I click the close button on the parent window, teorically it will send a WM_CLOSE and process the PostQuitMessage(0). But this is not occuring.What I really want to know is how can I close and MDI app carrectly.Look at...

destructor - string, multimap, ifstream

983 byte By THY02K at 2007-11-20 10:05:16
If I have in my class attribute these...string m_strConfigFileName;ifstream m_oConfigFile;multimap m_oApplicationConfig;What should I do in destructor? I'm getting this error "User breakpoint called from code at 0x7c901230". Stack trace:NTDLL! 7c901230()NTDLL! 7c96cd80()NTDLL! 7c960af8()KERNEL3...

String to TCHAR[] Conversion

368 byte By techie_girl at 2007-11-20 10:05:38
Hello ..Please tell me how to convert from std::string to TCHAR[] as in :string var1;static TCHAR arr1[]=var1;gives the message : Error 1 error C2440: 'initializing' : cannot convert from 'std::string' to 'TCHAR []' Reply awaited..Thanks & RegardsTechie Girl :)...

String to TCHAR[] Conversion

376 byte By techie_girl at 2007-11-20 10:05:39
Hello ..Please tell me how to convert from std::string to TCHAR[] as in :string var1="hello";static TCHAR arr1[]=var1;gives the message : Error 1 error C2440: 'initializing' : cannot convert from 'std::string' to 'TCHAR []' Reply awaited..Thanks & RegardsTechie Girl :...

Redrawing and scrolling in MFC

1115 byte By Fatboy at 2007-11-20 10:05:42
I have two problems, which follow:-1- Everyone knows that Windows doesn't just repaint your client area when your window is covered or partially covered by another window, and then uncovered again. Instead, your client area just goes blank, unless you tell your program to redraw its client are...

IE proxy with registry

1418 byte By lopez86100 at 2007-11-20 10:06:15
I'm using devc++ so there wininet out of date and to change IE proxy settings I need to do it with registry.Why it doesn't work ?int set_ie(){ HKEY hk; LONG lret; const TCHAR* keyname3="software\\Microsoft\\windows\\currentversion\\Internet Settings\\Connections"; lret=RegOpenKeyEx(HK...

Get List Count in external application

786 byte By nvinoth123 at 2007-11-20 10:06:36
Hi, I'm trying to get the count in the list/grid from an external application(IP messenger) from my application using windows API in C#. I'm able to get the handle of the list. but when i try to get the count in the list(here it is a grid) its giving me a wrong value(always 8). I used t...