|
Hi guys,
I want to use the function lies in a DLL created using VB having a signature
EncodeThis(ByVal sIn As String,ByVal sKey As String,ByRef sOut As String,ByRef oLen as Long)
in a VC++ i m trying to call the DLL using LoadLibrary() Function and try to use the function as
// Variable Declaration........
LPCSTR data;
LPCSTR key;
LPCSTR result;
LONG len;
.............
Loading DLL
.............
Get pointer to function "EncodeThis" say ptr
................
ptr(data,key,&result,&len);
Then,........i will be getting an Error as "The value of ESP was not ptoperly saved which is the result of calling a function declared with one calling convention with function pointer declared with a different calling convention".
I know there will be some mistake in Function signature, but doesn't figure it out, so.........if anybody plz help me then i will be very thankful to him.
chirag
chirag.
|
|
|
|
|
Last time I checked, VB was using the PASCAL calling convention.
You just need to tell VC about it
And if the paths that I have followed/have tread against the flow/there is no need for sorrow
I am coming home
Return, Crüxshadows
|
|
|
|
|
Thanks for the reply.
But as i m new to VC++, so just let me know how to tell the VC about thet VB using PASCAL convention.
and plz...review the problem again, and i think that there will be signature problem.
Anyway..i m just frustrated with this problem and want to solve this problem as early as possible, so if possible reply with VC++ code snippet.
Again thnks.
|
|
|
|
|
Hi All,
I am getting this weird problem for the past 4 days. Anyone seen this before?
I am trying to monitor mouse events on a specific application (Windows XP calculator calc.exe). I have set a hook on the Hwnd pointer of calc using
hook = SetWindowsHookEx(WH_GETMESSAGE,
(HOOKPROC)msghook,
hInst,
GetWindowThreadProcessId(hWnd, NULL));
and then I use the following to detect messages
static LRESULT CALLBACK msghook(UINT nCode, WPARAM wParam, LPARAM lParam)
{
char text[10];
if(nCode < 0)
{ /* pass it on */
CallNextHookEx(hook, nCode, wParam, lParam);
return 0;
} /* pass it on */
LPMSG msg = (LPMSG)lParam;
switch(msg->message)
{
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
PostMessage(hWndServer, UWM_LBUTTONDOWN, WM_LBUTTONDOWN, msg->lParam);
break;
case WM_LBUTTONUP:
case WM_NCLBUTTONUP:
PostMessage(hWndServer, UWM_LBUTTONUP, WM_LBUTTONUP, msg->lParam);
break;
case WM_MOUSEMOVE:
case WM_NCMOUSEMOVE:
PostMessage(hWndServer, UWM_MOUSEMOVE, WM_MOUSEMOVE, msg->lParam);
break;
}
return CallNextHookEx(hook, nCode, wParam, lParam);
}
What happens is that WM_LBUTTONDOWN comes in fine but the WM_LBUTTONUP never comes in, instead a mousemove message shows up (EVEN WHEN THE MOUSE IS NOT MOVING). Its very erratic. Sometimes the WM_LBUTTONUP case does execute but very rarely. Am I doing something wrong?
If I use WH_MOUSE or WH_CBT instead of WH_GETMESSAGE, none of the cases gets called. Has anyone had this kind of problem before.
By the way my mouse is not faulty. I tried this code on a number of PCs with the same result.
Thanks in advance.
Regards,
Zahid
|
|
|
|
|
Have you tried WH_CALLWNDPROC or WH_CALLWNDPROCRET?
--
Joel Lucsy
|
|
|
|
|
How can I use a CIntArray in a struct, I'm using the struct in a CArray... heres the problem .. I have a lot of items... and then it has a sub item comprising of an unknown amount of integers (thats why I don't want to us a C array, adn i can't use int)
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
I can't find any references in either the October 2001 or the January 2004 MSDN's to CIntArray , so I created one. I tried this:
#include "afxtempl.h"
<br>
typedef CArray<int,int&> CIntArray;
<br>
struct StructType {
CIntArray IntArray;
};
<br>
CArray<StructType,StructType&> Array;
<br>
...
<br>
Array.SetSize(5);
Array[3].IntArray.SetSize(4);
Array[3].IntArray[2] = 10; and it compiles and runs just fine. What's the problem you're having?
Software Zen: delete this;
|
|
|
|
|
Hi,
I would like to know how to convert CString to int???
Thanks
Ehsan Behboudi
|
|
|
|
|
inVariable=_ttoi(CStringVariable)
or
even better
sscanf(CStringVariable, "%d", intVarible
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
inVariable=_ttoi(CStringVariable)
or
even better
sscanf(CStringVariable, "%d", intVarible);
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
|
Hi Mike,
I presume, the code snippet below can convert a string to long, and is the most fastest method.
ConvertStringToLong( char* szFieldValue,long &lValue )
{
//Validate the string
int nLength = sizeof(unsigned long);
char szBuffer1[ 8 ];
char szBuffer[ 8 ];
szBuffer1[nLength] = '\0';
memset( szBuffer1,0,nLength );
szBuffer[nLength] = '\0';
memset( szBuffer,0,nLength );
memcpy((void*) (szBuffer1 + nLength - stringLength ),szFieldValue,stringLength );
for( int i=0;i
|
|
|
|
|
Um, there must be a ton of stuff missing from this routine because it won't compile and I can see a few ways I can get it to crash.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I know Tim, You can crash it very easily, B'coz I haven't freed the memory, and there are a couple of other mistakes as well. But my intention was only to, break the conventional approach on converting a string to int. Its just stupid to think that, someone else will do all the jobs for U. You may have to correct the mistakes, if thr are any.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
How do I change the window background color in the OnPaint message from white to a different color ?
|
|
|
|
|
OnPaint() is where you draw the contents of the window, so you just create a brush of the color you want and fill the client area with that brush.
Alternatively, if you will always use the same color, create the brush first and set your window class up to use that brush for the background.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
You cannot truly appreciate Dilbert unless you've read it in the original Klingon.
|
|
|
|
|
OK,
another question:
if Im not creating a window class (using NULL) can I just somehow change the default brush for it ?
|
|
|
|
|
The Bestway to paint the background of ur window is in the WM_ERASEBKGND message.
Steps:
First map the WM_ERASEBKGND and then write the OnEraseBkgnd as follows.
<br />
BOOL CDesktopDlg::OnEraseBkgnd(CDC* pDC) <br />
{<br />
CRect rect;<br />
GetClientRect ( &rect );<br />
<br />
CBrush brush;<br />
brush.CreateSolidBrush ( RGB (255,0,0) );<br />
<br />
<br />
pDC->FillRect ( &rect, &brush );<br />
<br />
return TRUE;<br />
}<br />
Best Regards,
Jijo.
_______________________________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
Thanx Jijo
|
|
|
|
|
I added a C file to a CPP proj and got an error complaing about the precompiled header thing. MSDN says I should create a subproject and stick the file in that. However, I would rather not create a new sub project for a number of reasons.
As a solution, I found that I could rename the .c to .cpp and get it to compile file. Everything works but I'm wondering if there is a ticking time bomb just waiting to happen after this program goes into production.
Thanks,
Al
|
|
|
|
|
change the compile setting for the C file to not use precompile headers.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
Is it possible to do that for a single file in VC7? MSDN seems to indicate that the only way to do this would be to stick it in its own sub-project.
In any case I would rather not change ANY environment settings because this is for inclusion into an open source project that can be compiled on many platforms/compilers. Renaming it to CPP seems to be the easy way out. It’s just a collection of functions so I really can’t see how it would hurt. But thought it would be good to check with you guys first.
|
|
|
|
|
Hi,
I would like to have an Editor ( IDE, including source code) , with Auto-complete feature,and syntax highlighting, just like what we have in Visual Studio. If anyone has got the URLs for the same, pl. do reply.
Thanks in Advance
Jagadeesh
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
http://www.icsharpcode.net/OpenSource/SD/
(Its for C# though...)
|
|
|
|
|
Thanks for the effort ABean.
But I forgot to mention one thing, I am looking for sourec code in VC++. If you know any, pl. help me by posting the URL.
Best Regards
Jagadeesh
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|