|
benjnp wrote:
I tried OnDialog::OnCancel before and it worked.
Yeap it will work and CDialog::OnOk() Work tooo ...
"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
|
|
|
|
|
Hi Sravan,
CWinApp::ExitInstance
virtual int ExitInstance( );
Return Value
The application's exit code; 0 indicates no errors, and values greater than 0 indicate an error. This value is used as the return value from WinMain.
Regards
Achim Klein
We can do no great things, only small things with great love. - Mother Theresa
|
|
|
|
|
How can I have multiple zoom in one view ? an object in CView with a zoom fact and another with its zoom fact?
|
|
|
|
|
Hi everybody. I have a problem. I have a file mapped in memory, and a pointer to section of that file, and i need to read n bytes from the file in memory begining in the pointer. If anybody can helpme i will be gratefull.
|
|
|
|
|
If the file's memory mapped, then you treat it exactly like memory - so 'reading n bytes' from the file is simply a memcpy(). If you want to emulate file-like behaviour, try something like (untested code!):
const char* gFileBase = address at the beginning of your memory mapped file;
size_t gFileSize = size of the file that was memory mapped;
size_t filePtr = 0;
int memfread(void* destination, size_t numBytes)
{
size_t bytesRemaining = gFileSize - filePtr;
if (numBytes > bytesRemaining)
numBytes = bytesRemaining;
memcpy(destination, gFileBase + filePtr, numBytes);
filePtr += numBytes;
return numBytes;
}
Something like that anyway - you can hopefully see how you might implement memfseek() and so forth.
Of course, ideally you'd reap the most benefits from a memory mapped file simpply by treating it pure memory. For example, if your file was an array of Foo structures:
Foo* fooArray = reinterpret_cast<Foo*>(gFileBase);
Matt Godbolt
Engineer, ProFactor Software
StyleManager project
-- modified at 7:06 Saturday 17th September, 2005
|
|
|
|
|
Create a class that has is initialized with a pointer to that section and it's size.
Every read request will increase the pointer by the amount of bytes read.
If that amount gets bigger than the section's size, the EOF is reached.
Don't try it, just do it!
|
|
|
|
|
Dear friends,
I want to call a function exposed by a DLL. For this purpose i am loading a DLL dynamically using LoadLibrary() and then calling GetProcAddress().
The name of the function i want to call is MSPeelerMain . I dont know about its parameters. Unfortunately the only example present in MSDN
is in VB where the function is declared as:
Function MSPeelerMain (ByVal sHtmlFile As String, ByVal sCmdOptions As String) As Integer
I want to call this function in C++ and as such i am declaring it as:
typedef int (*MYPROC)(LPTSTR, LPTSTR)
But when my program executes i am getting run time debug error:
The value of ESP was not properly saved across the function call.
This is usually a result of calling a function declared with one calling convention with a function pointer declared in other
calling convention
Can you tell me how to solve this problem ??
Ahsan
-- modified at 0:50 Saturday 17th September, 2005
|
|
|
|
|
Does modifying the typedef to indicate stdcall calling convention help?
typedef int (__stdcall *MYPROC)(LPTSTR, LPTSTR)
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Yes it worked
Thanks a lot.
Ahsan
|
|
|
|
|
|
Ahsan Askare wrote:
Function MSPeelerMain (ByVal sHtmlFile As String, ByVal sCmdOptions As String) As Integer
since VB -String = VC-BSTR
so you can try .....
typedef int (WINAPI *MYPROC)(BSTR, BSTR)
"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
|
|
|
|
|
use typedef int _stdcall (*MYPROC)(LPTSTR, LPTSTR)
the prorblem has to do with who is responsible for cleaning up the stack.
a programmer traped in a thugs body
|
|
|
|
|
Thanks;
But:
Please help me more obviously
|
|
|
|
|
What about Interprocess communiccation:- here is link for same :-
http://www.codeproject.com/threads/[^]
"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
|
|
|
|
|
Sorry!
But I can not find any cases about Windows Services in the "Interprocess communiccation"
|
|
|
|
|
Mojtaba_Service wrote:
about Windows Services in the "Interprocess communiccation
Interprocess Communication is use to communicate between two or more process (based on method you are using). Now let if you Window Service have window it must have HWND associated with it... so using Simplest Interprocess mechanism i.e. Window Message you can Post your User Defined messages (WM_APP+ and WM_USER+) with some other program/process and instruct the service to work according to it...
This is just simple logic. Better you try this logic with two desktop-based application before applying directly to service.
"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
|
|
|
|
|
Services have no front end.
|
|
|
|
|
Igor Vigdorchik wrote:
Services have no front end.
Yeap service don't have any FrontEnd, but you can have both Windows and front end for service....( clue: desktop interactice service)
"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
|
|
|
|
|
|
is there a way to get the handle of aprocess without calling openprocess if i have the pid ?
gabby
|
|
|
|
|
euacela wrote:
openprocess if i have the pid ?
AFAIK, NO!
"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
|
|
|
|
|
Definitely, no.
Definitely, yes - if you can access information on the Kernel internal structures. But even if so, your app may not work on different Windows versions.
One always gets the deserved.
http://www.silveragesoftware.com/hffr.html Update your source code with my tool HandyFile Find And Replace!
|
|
|
|
|
Even if he had kernel access he couldn't!
The kernel does not use handles for the process. It uses pointers to EPROCESS structures!
Don't try it, just do it!
|
|
|
|
|
I know that I can make a driver and use deviceiocontrol and get the handle out but just tell me the function.
The EPROCESS structure doesn't have a member for the handle.
I know about this function
NTSYSAPI
NTSTATUS
NTAPI
PsLookupProcessByProcessId (
IN ULONG ProcessId,
OUT PEPROCESS *Process
);
and this is all I know about eprocess
typedef struct _EPROCESS {
KPROCESS Pcb;
EX_PUSH_LOCK ProcessLock;
...
UCHAR ImageFileName[16];
...
UCHAR PriorityClass;
BOOLEAN WorkingSetAcquiredUnsafe;
} EPROCESS, *PEPROCESS;
is KPROCESS the process HANDLE and if it is what ACCESS does it have, i supose PROCESS_ALL_ACCESS right ??/
gabby
|
|
|
|
|
i wonder how can I get an IMAGE_FUNCTION_ENTRY of a certain function in a dll
is it
IMAGE_FUNCTION_ENTRY *IFE=(IMAGE_FUNCTION_ENTRY *)((BYTE *)hMod+FunctionAddress) ????
this returns a non NULL value but I am not sure if it is a valid structure
gabby
|
|
|
|