|
Dear Chandu,
This wouldnt suit my application.
What i m trying to do is that if OnReceive() of Winsock doesnt get triggered every 2 secs then i display the message box.
What you are doing is, you are setting start and stop somewhere(maybe in some function)...so if this funtion never gets called then i cant detect a timeout...
i hope you got the problem
|
|
|
|
|
Why don't you instead start a timer with a timeout of 2 seconds ? Then, in your OnReceive function, you can kill it and restart a new one.
And in the OnTimer function, you display your message box (the OnTimer function will only get called when the timer fires).
|
|
|
|
|
Dear Cedric,
Thanks for your suggestion. I am new to using timers but i reckon that this is what i would need to solve my problem(since a 'time-out' will trigger an event and that's what i want). If wrong then please correct me. I havent yet tried using 'timer'(stuck up with something more critical) but i have to within the next 1 day.
Thanks...
|
|
|
|
|
As Cedric Moonen said, you can set a timer. For a socket there will be a window assiciated with it.That window is a member of the structure_AFX_SOCK_THREAD_STATE; you will be able to get a pointer of that structure using _AFX_SOCK_THREAD_STATE* pState = _afxSockThreadState;
|
|
|
|
|
Hi
I am learning com programming. I want to ask a question about output files in idl compilation.
When i compile this file. It only generates FileName_h.h and FileName_i.c files.
import "wtypes.idl";<br />
<br />
[<br />
uuid(6F818C55-E6AD-488b-9EB6-511C0CCC0612),<br />
version(1.0)<br />
]<br />
library LibCOMServer<br />
{<br />
importlib("stdole32.tlb");<br />
importlib("stdole.tlb"); <br />
<br />
[ uuid(7F24AABF-C822-4c18-9432-21433208F4DC), <br />
oleautomation <br />
]<br />
interface ICOMServer : IUnknown<br />
{<br />
HRESULT Name([out] BSTR* objectname);<br />
}<br />
<br />
<br />
[ uuid(6AE24C34-1466-482e-9407-90B98798A712),<br />
helpstring("COMServer object") <br />
]<br />
coclass CoCOMServer<br />
{<br />
[default] interface ICOMServer;<br />
}<br />
}
But when i compile this code. It generates FileName_h.h, FileName_i.c, DllData.c, FleName_p.c
import "oaidl.idl"; <br />
import "ocidl.idl"; <br />
<br />
[<br />
object, <br />
uuid(318B4AD0-06A7-11d3-9B58-0080C8E11F14), <br />
helpstring("IVideo Interface"), <br />
pointer_default(unique) <br />
] <br />
interface IVideo : IUnknown <br />
{<br />
[helpstring("Obtain the signal value")] <br />
HRESULT GetSignalValue([out, retval] long* val); <br />
}; <br />
<br />
[<br />
object, <br />
uuid(318B4AD1-06A7-11d3-9B58-0080C8E11F14), <br />
helpstring("ISVideo Interface"), <br />
pointer_default(unique) <br />
] <br />
interface ISVideo : IUnknown <br />
{<br />
[helpstring("Obtain the S-Video signal value")] <br />
HRESULT GetSVideoSignalValue([out, retval] long* val); <br />
}; <br />
[<br />
uuid(318B4AD2-06A7-11d3-9B58-0080C8E11F14), <br />
version(1.0), <br />
helpstring("VCR Type Library") <br />
] <br />
library VcrLib <br />
{<br />
importlib("stdole32.tlb"); <br />
importlib("stdole2.tlb"); <br />
<br />
[<br />
uuid(318B4AD3-06A7-11d3-9B58-0080C8E11F14), <br />
helpstring("VCR Class") <br />
] <br />
coclass VCR <br />
{<br />
interface IVideo; <br />
interface ISVideo; <br />
}; <br />
<br />
};
I don't understand what the reason for this. What is absence in first idl files so the other files can't generated.
Thanks
|
|
|
|
|
idl is a little tricky. I am not a specialist.
Arent in the first place:
import "wtypes.idl";
in the seconsd:
import "oaidl.idl";
import "ocidl.idl";
You must look in your files. Often is it a "dependency", so if another file is included, there are extra items activated.
It looks like the second case is a dll project.
Greetings from Germany
|
|
|
|
|
Thank you.
I created an empty dll project and i only added .idl file and debug it both of them.
I also replaces import files. But nothing changes. It seems, It is not about import part of the codes.
|
|
|
|
|
I remember befor 7 years I got worked with some idl, and my collegues said me "that makes all the compiler: DO NOT TOUCH".
Sorry I got no clue. I can only guess, that the project wizard does some work to enable *.idl processing.
Greetings from Germany
|
|
|
|
|
iam using static picture control on the dialog box. actually my bitmap has alpha and red background color. this bitmap attached to static picture control. then problem is in Windows XP supporting alpha channel but in Windows 2000 it showing
same back ground color .
what i want is how can i hide the background color of the static picture control?
one more thing i wrote like this
<br />
<br />
HBRUSH CFileSelectionDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)<br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
if(pWnd->GetDlgCtrlID()==IDC_STATIC_IMG)<br />
pDC->SetBkMode(TRANSPARENT); <br />
<br />
return hbr;<br />
}<br />
<br />
here IDC_STATIC_IMG is a member variable of static picture control.
Regards,
Srinivas
|
|
|
|
|
Try returning the result of GetStockObject(NULL_BRUSH) instead of the brush that the CDialog::OnCtlColor returns
|
|
|
|
|
Hi,
I am trying to read mrt.log file programatically (vc++).
This file is generated after running mrt.exe (malicious software removal tool by microsoft - can be freely downloaded from msdn).
But I am not able to read this file. I am displaying the contents of a file line by line.
It is giving some garbage values.
If I change its extn to .txt, i still cant read it.
If I copy its contents in some other .txt file,then I am able to read it.
It is behaving in strange way.
Is there any restriction on reading this file or something?
Can someone please guide me for reading this file?
Thanks,
Manasi
|
|
|
|
|
Manasi D wrote: I am trying to read mrt.log file programatically (vc++).
I am not sure, but may be the file is not purley ASCII file. It may be UNICODE or UTF-8 encode. Open the file in a binary mode using msdev IDE, and check few bytes in the begining.
if the first two is FF, FE -> it will be UNICODE,
EF BB BF -> UTF-8 and so on. So first you need to identify the format in which the file is encode. You can convert texts in such formats to normal string using the WideCharToMultiByte() and MultiByteToWideChar() API's
|
|
|
|
|
Is there an api or method to convert a file path to the dos file path ( 8.3 ). I can't seem to find much on the topic.
|
|
|
|
|
|
Thanks for that. Came across PathYetAnotherMakeUniqueName() while looking through MSDN. At least somebody at MS has a sense of humour.
|
|
|
|
|
hi friends
can anyone explain me the difference b/w Copy constructor & Assignment operator.
when each of them are invoked.
when we need to overload an assignment operator ?.
please explain with an example C++ program
thanks and regards
prashant
|
|
|
|
|
I suggest you see www.cplusplus.com about Copy constructor and overload operator on that site you can find example.
|
|
|
|
|
a copy constructor is a constructor, ie. it constructs a new object.
the operator= works on an existing object...
CMyObj obj1();
CMyObj obj2 = obj1;
CMyObj obj3;
obj3 = obj2;
|
|
|
|
|
hi all
Is it possible to compile UTF-8 build in visual cpp or is it neccessary to convert it to UTF-16?
if it is possible do let me know ho it is possible.
thanks in advance
|
|
|
|
|
The project option "Character Set" could be what you are looking for.
There are three settings avaiable:
- Use Multi-Byte Character Set
- Use Unicode Character Set
- not set
This option can be set in the project configuration->General.
|
|
|
|
|
puneet_cha wrote: compile UTF-8 build in visual cpp or is it neccessary to convert it to UTF-16?
Neither option is available.
The "Unicode" option was put in place back when "Unicode" was only 16-bits and did not use surrogate pairs or groups. The term UCS-2 is probably closer to Windows "Unicode" or the compiler "Unicode" option.
UTF-16 has 16-bit code units but can use surrogate pairs to represent unicode code points that require more than 16-bits to represent them. Windows "Unicode" is simply 16-bits for every code point, no more, no less.
UCS-2 and UTF-16 map the same but the code units that are used to represent the first part of a surrogate grouping in UTF-16 are ignored in UCS-2.
However, UCS-2 and UTF-16 as well as the term "Unicode" are still mistakenly used interchangeably which causes some confusion.
|
|
|
|
|
bob16972 wrote: Neither option is available.
Or is it?
I got to thinking, and I've not checked VC++ 2005 or beyond. Do they still use "MBCS" and "UNICODE" for compiler options or have they finally started using encoding terms to describe the options.
Does VC++ 2005 or beyond use "UTF-16" and "UTF-8" instead of "MBCS" and "UNICODE" for the compiler options.
I came across a blog stating that Windows XP and above started supporting surrogates so it could be officially called UTF-16 on those operating systems. However, this would conflict with the wide character nature of BSTR and wide chars so I'm guessing the surrogates would still be illegal code units.
Anyone have any info?
|
|
|
|
|
UTF-8 is not supported natively in Windows. Your choices are MBCS or UTF-16 ("Unicode"). You'll need to convert your strings to UTF-8 manually whenever you need UTF-8.
|
|
|
|
|
This has got to be an easy question, but I can't find a place to start.
I want to give a command inside my code.
The problem is when the path has a space in it like c:\Program Files\...
I wanted to use
system(buff) where
buff = "c:\Program Files\myDir\myProg"
This works fine for paths without spaces, but there is something to replace it for paths with spaces.
I just can't remember what it is.
Thanks,
Ilan
|
|
|
|
|
IlanTal wrote: The problem is when the path has a space in it like c:\Program Files\...
put quote( " ) before and after the file path like..
"c:\Program Files\Windows Media Player\wmplayer.exe"
|
|
|
|