|
hmmm...
this is most humiliating...
so simple
I could have sworn I had included it!
dang!
*bangs his head against the wall*
Thank you very much!!
regards
/Ludde
|
|
|
|
|
Hi,
I saw a long list of answers to this query and one from micheal dunn, when i read the question i knew and was obvious that you have missed to include the string, and for some reason before reading all the answers i knew the rite one will come from Mike, and so it was
I Touched Osama Bin Ladens Bushy Beard
|
|
|
|
|
But how could he create a std::map<int, std::string> ..?
--
If there was a problem, Yo, I'll solve it!
Check out the hook while my DJ revolves it.
|
|
|
|
|
i have packaged an VC++ created EXE and created a shortcut for it using InstallShield . Now when i launch the shortcut from the start menu , the application comes up but gives a message saying it cannot find an INI file which is located in the same folder as the EXE .
Now if i run the EXE directly from the folder it works fine .
In my code the reference to the INI file is a "./MyInIFile.ini !
How do i resolve this ?
|
|
|
|
|
Set the "Start in" property of the shortcut.
Or:
Save a INSTALLDIR key to the registry and load the ini relative to that instead of current dir.
(I would prefer method 2, it's not as sensitive to "users" as method 1)
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
|
|
|
|
|
I try to register a categoty using ATL/COM
After registering the registry looks pretty OK.
OleView diaplays the categoty
In Left Tree Pane: Grouped by Ccategory (child tree list)
I cannot se muy category, but in detailed right pane list-view
I can see my category beeing there.
The bad thing is when I enumerate the category info
I cannot find it.
All COM calls returrn S_OK;
// here Is the registration code
--------------------------------------------------
USES_CONVERSION;
CComPtr<icatregister> catInfo;
HRESULT hr = catInfo.CoCreateInstance(CLSID_StdComponentCategoriesMgr);
if(FAILED(hr))return hr;
// ensure the category registration
CATEGORYINFO catinfo;
catinfo.catid = MY_CATID;
catinfo.lcid = 0x0409 ;
::wcscpy(catinfo.szDescription, T2W (catDescription));
catInfo->RegisterCategories(1, &catinfo);
CComPtr<icatregister> catInfo;
HRESULT hr = catInfo.CoCreateInstance(CLSID_StdComponentCategoriesMgr);
if(FAILED(hr))return hr;
CATID catid = catidIn;
catInfo->RegisterClassImplCategories(CLSID_MyDLL,1,&catid);
// here is the enumaration code
--------------------------------------------------
CComPtr<icatinformation> ci;
HRESULT hr = ci.CoCreateInstance(CLSID_StdComponentCategoriesMgr);
if(FAILED(hr)) return;
CComPtr<ienumcategoryinfo> spEci;
if(SUCCEEDED(ci->EnumCategories(GetUserDefaultLCID(), &spEci)))
{
ULONG nRet = 0;
CATEGORYINFO cif;
while(SUCCEEDED(spEci->Next(1,&cif,&nRet)) && nRet==1)
{
if (cif.catid == NY_CATID)
{
TRACE("found \r\n");
}
}
}
|
|
|
|
|
I think in if comparision you have used NY_CATID. Previously it is MY_CATID. So verify it once.
|
|
|
|
|
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.
|
|
|
|