|
use winsock2.h
and try WSACleanup() after to close everything
and also closesocket()
gabby
|
|
|
|
|
You can't replace closesocket(). The implementation is going to effect data stored in the TCP/IP stack that you don't have access to.
KellyR wrote:
if I include winsock.h and such, the defines collide with too many of my other defines
I believe you must solve that problem.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Hi,
i have a dialog based app with a PretranslateMessage and a OnKeyUp Function that looks like this
BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN)
{
switch (pMsg->wParam)
{
case VK_ESCAPE:
break;
....
}
return CDialog::PreTranslateMessage(pMsg);
}
void CMyDlg::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
MessageBox ("Up");
CDialog::OnKeyUp(nChar, nRepCnt, nFlags);
}
But the Key up does not work ;
Exception : if i place it directly into the PretranslateMessage Function I can handle the event.
What is the problem ?
thanks
ch
|
|
|
|
|
So here is the problem ... i've been searching for days in the interet but found nothing that could help me. If someone knows the solution of my problem ...
So I wrote a multilanguage application with nice resource only dll's for the dialog boxes, menus ... It works fine libraries and resources are loaded, but there's a problem for two of them.
My application is made of 2 CFormview. It seems that the application loads once the resources for thoses two formviews during the CMainFrame::OnCreateClientfunction, and then nevermore.
Is there a possibility for a view to reload it's dialog resource at runtime ? I've been trying updateview, updatedate, invalidate ... Im'not sure that it is possible .
Tank you for your answer !
Djizzio
|
|
|
|
|
Hello,
It seems that in the app. where I'm working on, the default behaviour of OnKeyDown doesn't seem to catch the return key.
Can you modify this?
Can you modify this for 1 class and not for the entire app.?
tnx!
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Hi ,
you need to overide the virtualfunction OnGetDlgCode, and then write the following line of code . Your Class must be derived from CWnd.
return CYourClass::OnGetDlgCode() | DLGC_WANTALLKEYS;
Djizzio
|
|
|
|
|
Hey,
tnx for your reply.
I did this:
<br />
UINT CtrlFlexArray::OnGetDlgCode(){<br />
return CWnd::OnGetDlgCode() | DLGC_WANTALLKEYS;<br />
}
but the OnKeyDown still doesn't catch the return key.
Did I forgot something or did I do something wrong?
(NOTE: CtrlFlexArray is derived from CvsFlexArray and CvsFlexArray from CWnd, but I don't think this is the problem)
tnx!
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
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.
|
|
|
|