|
The heap create makes a 'region' of memory available thorugh the API. To determine where the memory is actually located, you must use the pointer returned from HeapAlloc. Allocate a small block of memory, say 8 bytes, using HeapAlloc and then pass that pointer into the VirtualQueryEx function.
LPVOID lpMyMem = HeapAlloc(hHeap, 0, 8);
Also, VirtualQueryEx size is sizeof() not the size of the memory you think you got.
VirtualQueryEx( hProcess, lpMyMem, &MemInfo, sizeof(MemInfo) );
This should let you know how much memory the Heap has comitted and reserved, and its true starting address, so you can call VirtualLock.
|
|
|
|
|
Reposting here since I didn't get any responce in the c# forum.
My app's written in c#, but the error's being generated by a win32 api call. I'm using the following 3 api calls as demonstrated in the msdn article to monitor changes being made to a folder over samba (FileSystemWatcher won't do this). In my test app the water class works perfectly. When I use my watcher class in my main app everything is fine with one copy running. With two copies though, FindNextChangeNotification returns false and generates errorcode 0x64006e as returned by Marshal.GetLastWin32Error(). Win32Exception.Message describes this as an uknown error, and no error codes with this large a value are listed in msdn, or winError.h. Looking at the code between my main app and my tester I'm not seeing any meaningful differences, and with an unknown error I don't know wehre to be looking. The biggest difference between the two is that when a change occurs my tester just throws up a message box, while my main app reloads all the files in the folder. (There're only a handful so the performance hit from loading everything isn't enough to justify the extra work needed to ID which file was modified).
FindFirstChangeNotification
WaitForMultipleObjects
FindNextChangeNotification
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/obtaining_directory_change_notifications.asp
|
|
|
|
|
Hi,
in my project i have to use TrimStart(), for this i included "mscorlib.dll",
but i am getting error message as
D:\Sheshidar\DiplomArbeit\DAP\DAPDlg.cpp(8) : fatal error C1083: Cannot open include file: 'mscorlib.dll': No such file or directory
when i searched for help most of the results giving for VC++.Net, but i am working on VC++6.0
can u help me in this how to overcome on this error and how to add mscorlib.dll for my work.
thanking you
have a nice time
ciao
sheshidar patnam
|
|
|
|
|
you can't use the .Net framework in VC 6.0. You will have to use CString or the C-Runtime Library funcitons.
|
|
|
|
|
Thx Willy, but which C-Runtime Library funcitons i have to use instead of Timstart()?
|
|
|
|
|
The easiest way is to use CString LeftTrim, but if you can't use CString. You might be able to use StrTrim, but it will remove the chars from the left and right, so if that will not work for you, you will have to loop through the string.
|
|
|
|
|
FRIEND DONT INCLUDE DLL FILE
dll project generates two important files
1).dll
2) .lib
A)copy these both files in your main project debug dirctory
B)copy the header file of the all\required classes used in DLL PROJECT in to main project directory.
Include these header files wherever it does not identify class
if required.
C)IN MAIN PROJECT Goto Menu Project - > settings open the link tab inthat
Object\link modules type the name of lib file with extension
D) In addition copy the dll and lib in your main project folder also remember earlier i asked to copy in debug folder where your exe gets generated now i am asking just for safety.
REMEMBER DLL IS NOT HEADER FILE TO INCLUDE
still problem contact me
shivditya@hotmail.com
|| ART OF LIVING ||
|
|
|
|
|
where can i find examples for Messages Pumps in MFC.. BTW what's a message pump? does it deal with send,post,despatch,etc??
He is like a one-legged man in a bum kicking competition. -Novjot Sidhu
--[v]--
|
|
|
|
|
VivekuniQ wrote: what's a message pump? does it deal with send,post,despatch,etc??
A program's message loop reads any pending message from the message queue and then dispatches that message back to Windows, which then calls your program's window procedure with that message as a parameter. Without MFC, you are responsible for both the message loop and the window procedure. MFC handles this for you.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I got this request from my boss.. :
Are you familiar with writing “message pumps”?
This is where you would “push” and “pop” off of dynamic arrays to control threading of commands to API’s.
Multiple threads can “push” messages onto the message stack using a single locking mutex and one single thread “pops” the messages off of the message stack and sends them to the API (using the same locking mutex).
--------------------------------------
what he means actually?.. yeaa we can send messages to the queue.. using sendmessage,postmessage..but should i go for win32 api ? where these messages would be processed by the wndproc ? but whatz the need for mutex here?
--[v]--
|
|
|
|
|
VivekuniQ wrote: one single thread “pops” the messages off of the message stack and sends them to the API (using the same locking mutex)
whatz this i dont understand.. sends them to the API??
He is like a one-legged man in a bum kicking competition. -Novjot Sidhu
--[v]--
|
|
|
|
|
I'm curious why you are being asked to do something that Windows already does and does well. If you use SendMessage() , control does not return until after the window procedure has processed the message. If you use PostMessage() , control returns immediately.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
i guess he's talking in context with the user defined messages.. i'll get back to you after getting a clear requirement.
thanks.
--[v]--
|
|
|
|
|
VivekuniQ wrote: i guess he's talking in context with the user defined messages..
In terms of how the message is entered into the message queue (SendMessage() vs. PostMessage() ), there is no difference between a user-defined message and a system message. If the default window procedure sees a message it does not care about (e.g., user-defined message), the message is ignored. If your window procedure sees a message it does not care about (e.g., system message), the message is ignored.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
i have an application in which microsoft word is embedded. i want to get the caret position. Here GetCaretPos is not working. Can anybody help me out?
i tried Accessible::g_accLocation also.
-- modified at 9:15 Friday 28th October, 2005
|
|
|
|
|
I have some problem with my printer.The code snippet written below is Writting the Text on the Printer.But i am unable to check this with my machine.Can anyone Paste that code & check whether the Text is printing or not.
Steps to Follow:
1) Create a new Dialog Based Application
2) On the OnOk function paste the below code .
Change the printer name as ur own.
--------------------------------------------------------------------
void OnOk()
{
HANDLE hPrinter;
DOC_INFO_1 DocInfo;
DocInfo.pDatatype = "RAW"; // datatype is Null (it can be EMF also)
DocInfo.pDocName = "Named Document"; // Name of the Dopcument
DocInfo.pOutputFile = NULL; // Output is to the printer
DWORD written; // For the number of bytes written to the printer
char cBuffer[20] = "MyTextBuffer\f";
OpenPrinter("Lexmark 2200 Series",&hPrinter,NULL);//you should change
// the name of the printer
StartDocPrinter(hPrinter,1,(LPBYTE)&DocInfo);
StartPagePrinter(hPrinter);
WritePrinter(hPrintercBuffer,sizeof(cBuffer),&written);
EndPagePrinter(hPrinter);
EndDocPrinter(hPrinter);
ClosePrinter(hPrinter);
}
|
|
|
|
|
Hello,
can body tell me how to send email in VC6 using CDO.
|
|
|
|
|
naeemnimi wrote: using CDO.
What's CDO stands for
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
ThatsAlok wrote: What's CDO stands for
Collaboration Data Objects is an object library that exposes the interfaces of MAPI. Because it is based on COM, it is language independent. To collaborate means to work together, especially in a joint intellectual effort, much like Outlook does.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: To collaborate means to work together, especially in a joint intellectual effort, much like Outlook does.
Thats Great
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hello,
I dont know, how to implementate a registration script
"hInstance needs to be the module / instance handle
of the module that contains your server registration
script (resource ID 102) .."
the server registration script is importand to
register my OPC Server.
RegisterServer()
HRESULT RegisterServer(void)
Return Values S_OK upon success, otherwise the result code
returned from the ATL registrar component.
The success of this operation is dependent on the application
including a registry script resource as part of its EXE.
The resource ID MUST be 102. An example resource script
is shown below:
HKCR
{
NDI.SimulationSvr.1 = s 'NDI Simulation Server'
{ CLSID = s '{1E52DE00-FA5E-11d2-91C6-F8E932000000}'
...
Best regards
Thomas
|
|
|
|
|
I'm converting a project from a VC++ ActiveX control to a C++ .net control.
The mouse button handling will change mode so that if left button is pressed on thing happens, right button does something else, and both buttons does another thing. This works OK but after having pressed both mouse buttons and then releasing one of the buttons the control loses capture (Control::Capture returns false). Under ActiveX/COM it didn't behave like this.
I've tried tracking the capture state during the mousedown and mouseup event handlers but still can't see what's going wrong.
Anybody got any ideas?
Thanks,
Dan
|
|
|
|
|
Hello,
Can somebody would tell me how to send email in C++ using smtp.
|
|
|
|
|
naeemnimi wrote: Can somebody would tell me how to send email in C++ using smtp.
here is an example :-
http://www.codeproject.com/internet/csmtpconn.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|