|
followait wrote: Any doc?
Thanks.
Hope this helps: Download VCRedist[^]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
followait wrote: It can't run under Window XP home edition
do you have any error message my any chance ?
|
|
|
|
|
Hello friend,
I am using VC6.0 IDE.
I have created MyDll.dll and write one exported function as below.
#ifdef TNS_EXPORTS
#define MyDll_API __declspec(dllexport)
#else
#define MyDll_API __declspec(dllimport)
#endif
...DllMain()....
extern "C" MyDll_API int CALLBACK DLLPRoc(char *pMsg,int nVal)
{
MessageBox(NULL,"DLLPRoc","MyDll_API",MB_OK);
return 1;
}
Inside Main.cpp
typedef int (CALLBACK *MYPROC)(char *pMsg,int nVal);
int Proc(char *pMsg,int nVal)
{
ret
}
int main(int argc, char* argv[])
{
HINSTANCE hIns=LoadLibrary("..MyDll\\Release\\MyDll.dll");
if(hIns==NULL)
return 0;
MYPROC pProc=(MYPROC)GetProcAddress(hIns,"DLLPRoc");
pProc=&Proc;
}
My problem is Proc doesn't receive acknowlegement.
I want the Proc will continuosly run as a callback procedure and receive the messages inside DLLProc in MyDLL.
Please give me suggestion and if po
ssible give some sample application
abhi
|
|
|
|
|
Please format your code properly so that it is a bit easier to read.
AbhijitAkude wrote: My problem is Proc doesn't receive acknowlegement.
What do you mean by "receive acknowlegement" ?
AbhijitAkude wrote: int Proc(char *pMsg,int nVal)
{
ret
}
What's that and what is that doing in main.cpp ?
So please explain what you are trying to achieve and what the exact problem is.
|
|
|
|
|
AbhijitAkude wrote: MYPROC pProc=(MYPROC)GetProcAddress(hIns,"DLLPRoc");
BTW, you just want to call the function
MyDll_API int CALLBACK DLLPRoc(char *pMsg,int nVal)
as it is.
int main(int argc, char* argv[])
{
char msg = 10;
DLLPRoc (&msg, 10);
}
provided the declaration is visible to the exe as __declspec(dllimport) for MyDll_API
modified on Saturday, May 10, 2008 4:06 AM
|
|
|
|
|
Hi,
What is mean by the following statement
<br />
MYPROC pProc=(MYPROC)GetProcAddress(hIns,"DLLPRoc");<br />
pProc=&Proc;<br />
u got the address of DLLProc in pProc then you are replacing it with address of local function
<br />
int Proc(char *pMsg,int nVal)<br />
{<br />
ret<br />
}<br />
<br />
thanks
Nitheesh
|
|
|
|
|
Its defensive approach, if he didn't get DLLPRoc (it's sure), use the local function.
|
|
|
|
|
you have pass the pProc to another function which calls this CALLBACK
|
|
|
|
|
|
Hi all..
I am TRYING TO write to a log file if any ERROR or information or warning messages in theformat
TSI0001 "iNFORMATION Message".
TSW0001 "WARNING Message".
TSE0001 "WARNING Message"...
so each time if any information or error message comes i should find the last inforamtion or erroe message and increment that no
example
TSI0001 "iNFORMATION Message".
TSW0001 "WARNING Message".
TSE0001 "WARNING Message"...
TSI0002 "iNFORMATION Message".
TSW0002 "WARNING Message".
TSE0002 "WARNING Message"...
please help me....
I am trying this code.
///////////////////////////////////////
switch(cType)
{
case 'W':
{
int iTSWCount = 0;
while(!inFile.eof())
{
inFile.getline(aLine,1000);
int iWPos = strLine.Find("TSW",0); if(iWPos!= 0)
{
iTSWCount++;
}
}
iCount = iTSWCount;
logfile<<"TSWOO"<<Warning;
break;
}
case 'I':
{
int iTSICount = 0;
while(!inFile.eof())
{
inFile.getline(aLine,1000);
int iWPos = strLine.Find("TSI",0);
if(iWPos != 0)
{
iTSICount++;
}
}
iCount = iTSICount;
logfile<<"TSWOO"<<Warning;
break;
}
case 'E':
{
int iTSECount = 0;
while(!inFile.eof())
{
inFile.getline(aLine,1000);
int iWPos = strLine.Find("TSE",0);
if(iWPos!= 0)
{
iTSECount++;
}
iCount = iTSECount;
}
iCount = iTSECount;
logfile<<"TSWOO"<<Warning;
break;
}
//////////////////////////////////////////////////////////////////////
thank you in advance
manju
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
Then what is the problem. And your code going to slow down the application as the log getting large size.
|
|
|
|
|
Hi sir..
Its not increment how i need
its increment in this way
TSI0001
TSW0002
TSE0003
TSI0004
BUT I WANT IF ERROR MSG FOUND INCREMENT THAT
TSI0001
TSW0001
TSE0001
TSI0002
TSW0002
TSE0002
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
Hi,
And my suggestion is that place the Count of each message type at begining of the file
like
TSW0003TSE0003
TSI0001 "iNFORMATION Message".
TSW0001 "WARNING Message".
TSE0001 "WARNING Message"...
TSI0002 "iNFORMATION Message".
TSW0002 "WARNING Message".
TSE0002 "WARNING Message"...
at the first line of the txt file. Then read this first before. Split or parse it . then increment your Count based on that.
that' s it
Nitheesh
|
|
|
|
|
hi..
what changes i have to meke in my code..
manju
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
Apart the api "IsWndow" which the microsoft doesnt recommend to be used other than by the thread which had created the window,is there any method to check for a valid hwnd i.e from an another thread?
dont want,dont want thinking,climbing on head and jumping grass!
(venda venda ennu vicharikumbol thellayill keyaree chadunnoda pulle!)
|
|
|
|
|
From MSDN:
A thread should not use IsWindow for a window that it did not create because the window could be destroyed after this function was called. Further, because window handles are recycled the handle could even point to a different window.
Are you sure this is a concern? If you're going to do anything with the HWND the same applies (it could be destroyed). Just use IsWindow .
Steve
|
|
|
|
|
If the target window is a top level window you can install a hook (see WH_SHELL) to be notified about destroying top level windows.
But frankly, no matter what technique you use, you can be never sure. If everything looks ok and you send a message to that window, the window still can be destroyed in the same moment(almost the same). Or while is processing your message. Simply there is no way to prevent a foreign window from beeing destroyed anytime.
The only thing you can do is to implement thoroughful error processing, verify the effects of each of the messages sent and check regularly if the handle is still for the same window and not reused for another one.
Working with a foreign windows is something similar to working with dialog boxes. You can never be sure what stupidity will a user type in an edit box so you have to check everything.
I think a window beeing destroyed exactly in the very moment when you need it, is a very rare occurence. Just make sure to limit to minimum the damages of such an event. If your software stops abruptly and hours of the user's unsaved work are gone, that's unacceptable. If the only thing that happens is an error message "Internal error, please repeat the last command", that's acceptable, even if it's not desirable. Even the best software fails sometimes. The only question is how it fails: disastruously or gracefully ?
|
|
|
|
|
hi...
I have an application which send data to some "InputData.txt".
Now if i click " FILE->Save " then it needs to be ask for saving that "InputData.txt" in browsed Location!!
can u help in this regard..
Thanks in advanvce!!!!!
|
|
|
|
|
So, was your previous query solved? Why don't you take a little time to thank the ones who solved it before asking the next question?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I adjust for troll's vote for now as I think CPallini will take some more hours.
|
|
|
|
|
I think he is sleep now.
|
|
|
|
|
Thanks for the vote man. I appreciate it.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I see that as the advance adjustment for the foreseen troll's vote.
|
|
|
|
|
Hi,
Handle the Save click and in Save Click handler do the Following
CFileDialog dlg;
if(dlg.DoModal() == IDOK)
{
CString fileName = dlg.GetPathName();
}
thanks
Nitheesh
|
|
|
|
|
If you properly used SDI framework in MFC, it will do for you.
|
|
|
|