|
Don't forget to add
ON_WM_GETDLGCODE()
to the message map of your class.
|
|
|
|
|
|
I found my error;
Forgot to add a WM message;
but hey, now it works
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
I want to install three hooks in a dll,one is WH_GETMESSAGE, two is WH_CBT,the other is WH_SHELL,the first hook is installed successfully but the second failed,codes as below:
BOOL __declspec(dllexport)__stdcall installhookCBT(HWND hCallProc)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
hCallHook=hCallProc;
hkbCBT=SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTProc,hins,0);
if(NULL == hkbCBT)
{
DWORD d=GetLastError();
CString str;
str.Format("%d",d);
CFile file;
file.Open("D:\\1.txt",CFile::modeCreate|CFile::modeWrite);
file.Write(str,str.GetLength());
file.Close();
return FALSE;
}
return TRUE;
}
value d is 0,why?
this error is happened today,but all three hooks are installed successfully yesterday.
|
|
|
|
|
Hi,
I want to get the process path name..The scenario is like this..
I have same two .exe's in two different folder, which calls a single dll file in which i need to know which ever process is currently using the dll, I need to know it's path name...I get a wrong path when i use GetModuleFileName()API..
Give me some tips..
Shiva P
|
|
|
|
|
Maybe GetCurrentProcess, followed by OpenProcess, followed by GetModuleHandle with the process handle could do it. I haven't tried it, just guessing.
I hope this helps
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
Maybe GetCurrentProcess, followed by OpenProcess, followed by GetModuleHandle with the process handle could do it. I haven't tried it, just guessing.
I hope this helps
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
GetModuleFileName(NULL, ...) is what you want to call from within the EXE.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
TssPrasad wrote:
I have same two .exe's in two different folder, which calls a single dll file in which i need to know which ever process is currently using the dll
That's not how processes work. Each EXE has its own private instance of the DLL (there is one copy in memory, but nothing is shared unless you use shared memory or another IPC mechanism).
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
Hi Guys,
Iam working on an MFC application.am drawing some lines to the screen using the device context.Iam selecting a font of type "ANSI_FIXED_FONT".
Iam doing it as follows, & stores the font height in a "m_fontHeight" class variable.
m_deviceContext->SelectStockObject(ANSI_FIXED_FONT);
TEXTMETRIC fontMetric;
m_deviceContext->GetTextMetrics(&fontMetric);
m_fontHeight = fontMetric.tmHeight;
Now my question here is,will the font height iam getting here, will be the same on all windows machines.
For eg.- , if I get a FONTHEIGHT here as 13,Will it be the same on some other machine as well...
Thanks
|
|
|
|
|
Test it on another machine. I'd say font height is machine dependent.
Kuphryn
|
|
|
|
|
How to implement a scroll bars in CStatic-derived class. If I'm add following lines then scroll bar will visible, but WM_HSCROLL message not send to my CStatic-derived class.
EnableScrollBarCtrl(SB_HORZ);
SetScrollRange(SB_HORZ, 0, 100);
ShowScrollBar(SB_HORZ);
What's the problem?
Best regards,
Eugene Pustovoyt
ICQ UIN: 161325180
|
|
|
|
|
Hello!
I wanna write a Text in a tif picture.
It can be intern in the tif File (if it's possible) or the text can also stay in a corner of the picture...
Or if you know another (easyer) way to save a text into the tif picture, please tell me!!
I have no idea how i could do this!
Please Help me!
Thanks!
Greetings Ronny
|
|
|
|
|
Have you read the TIFF Format[^] specs?
If yes, then the easiest way I know about is:
01. Create your character matrices (these can be simple 2D byte arrays specifying the on/off status of a pixel) e.g
00011000
00100100
00100100
00111100
01000010
01000010
10000001
10000001
can be 'A'
02. now, create your image data using these.
03. Then create your tiff specification Tags.
04. Write all the data into a file.
I Hope this helps
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
Hello and thanks for your answer!
But sorry that was a little bit to fast for me!
I have a tif picture wich already exists, and i want to inser a text anyway.....
Or can you tell me what functions i have to use?
Thanks!
Ronny
|
|
|
|
|
Ok,
Try taking a look at the LibTiff[^] library.
It is an opensource library for working with tiff images. You'll get usage intructions on the site too.
What I was trying to say earlier was, that one way I found for writing text into image files is to create 2D pixel-value matrices for each character. i.e. each element in the matrix will be a pixel value. Then when you want to write a character in to an image, you just need to pick up the correct matrix and copy the pixel values in the correct positions. I'm not too sure even this explaination was good enough, well, I've never been too good at explaining things ... just take a look at libtiff, it should help a bit. Also, searching google will give you a lot of great tuts.
I hope this helps
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
Hello!
That was a great Link! The Library supports really gut functions....
I have already tried many of these functions, but there is also a big problem. When i create a tif File with Photoshop i can open the file without any problems but if i open the File who i have in my application it don't works.
Is it possible to load the tif file as bmp, so i can work with the bmp File and save it after as tif?
If it is possible how can i load it, to write in the bmp i should use the GDI (or not?), and how can i convert after the bmp in a tif file?
And it is very importand that the pic don't lose quality, is it possible with out losing quality?
I thank you very much for your help!
Ronny
|
|
|
|
|
I think the libtiff library gives you the image data... which you can work with. I'm not sure.
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
I'd like to write my own keyboard driver for Windows 2000/XP. (I want to move some keys around, and I'm not just talking about keys like CapsLock, Ctrl etc.)
I've searched on MSDN, but I haven't been able to find any information about how to write a keyboard driver. Can somebody point me in the right direction?
|
|
|
|
|
I don't think you want a keyboard driver (though that would work). Search for how to change the charicer map. Windows already has keyboard layouts for things like Dvorak. (control panels->keyboardinput locals->properties -- in windows 2000) Figure out how they work, and you can change your map with a lot less effort.
If you really want to write a driver, you need the DDK, which isn't normally a part of MSDN. Even then I'm not sure how much there is on keyboard drivers, but if you work at it there is enough.
|
|
|
|
|
can we access a pointer to vTable, in C++?? or is it tht pointer to vtable is only for the compiler??
if we can, how do we do it??
|
|
|
|
|
As far as I know it is not possible.
|
|
|
|
|
I m using SQLConfigDataSource( ) to create data source programaticaly
it is creating but it is not attaching the database when i chk it in administrative tools in ODBC on Clicking on New(my DSN name) DSN .. as we attach database with DSN
database name is date.mdb
code is :::
SQLConfigDataSource(NULL,ODBC_ADD_DSN, "Microsoft Access Driver (*.mdb)", "DSN=New\0" "Description=New Data Source\0" "FileType=Access\0" "Database=E:date\0");
reply me thanx
|
|
|
|
|
I use, n works for me :-P
GenLocalDSNString("Microsoft Access Driver (*.mdb)", "DSN=myDSN", "Description=Connection to local database", strPath,"FIL=MS Access");
}
void GenLocalDSNString(CString Driver, CString DSN, CString Desc, CString path, CString FIL)
{
BOOL failed=FALSE;
TCHAR strConnect[256];
int i = 0;
Concat(strConnect, DSN, &i);
Concat(strConnect, Desc,&i);
Concat(strConnect, "DBQ=", &i);
i = i-1;
Concat(strConnect, path,&i);
Concat(strConnect, FIL,&i);
SQLConfigDataSource(NULL,ODBC_REMOVE_SYS_DSN, Driver, strConnect);
//try to create a system DSN - if this fails create user DSN
if(!SQLConfigDataSource(NULL,ODBC_ADD_SYS_DSN, Driver,strConnect))
failed = TRUE;
if(failed)
{
failed = FALSE;
if(!SQLConfigDataSource(NULL,ODBC_CONFIG_DSN, Driver,strConnect))
failed = TRUE;
}
if (failed)
{
AfxMessageBox("DSN Creation Failed. Please Contact Support",MB_ICONWARNING);
}
}
void Concat(LPTSTR strDest, LPCTSTR strSrc, int* pnInt)
{
memcpy(strDest+*pnInt, strSrc, _tcslen(strSrc)+1);
*pnInt += _tcslen(strSrc)+1;
}
|
|
|
|
|
Where to place the actual hook code?
In CMainFrm or CWinApp.
|
|
|
|
|