|
Thanks for that. The '~' operator is not on MSDN, it's in the index, but the page has a large "Empty Index Entry" written across the top. So I am guessing it is the NOT operator?
|
|
|
|
|
yes, the ~ operator is the Bitwise NOT
cje
|
|
|
|
|
|
I need a function to get time(seconds and microseconds) in windows, like gettimeofday in Linux.
Can you help me?
Thanks
|
|
|
|
|
|
I need to get the microseconds too. What is the function, if exists?
thanks
|
|
|
|
|
Opps sorry, I saw milliseconds. I don't know if microseconds are supported.
led mike
|
|
|
|
|
afpr wrote: I need to get the microseconds too. What is the function, if exists?
Windows does not have that level of resolution. What exactly are you trying to do?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I'm trying to calculate time between send and receive a packet. I'm using packet.dll.
thanks
|
|
|
|
|
|
Check ::GetSystemTimeAsFileTime() in the MSDN library.
|
|
|
|
|
afpr wrote:
I need a function to get time(seconds and microseconds) in windows, like gettimeofday in Linux.
try Multimedia timers .. timeGetDevCaps api will starting api for same
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I have found a solution. Use this functions:
/* Initialize everything to 0 */
void sec_init(void)
{
LARGE_INTEGER lFreq, lCnt;
QueryPerformanceFrequency(&lFreq);
freq = (double)lFreq.LowPart;
QueryPerformanceCounter(&lCnt);
start = lCnt.LowPart;
}
/* return number of seconds since sec_init was called with
** a gross amount of detail
*/
double sec(void)
{
LARGE_INTEGER lCnt;
long tcnt;
QueryPerformanceCounter(&lCnt);
tcnt = lCnt.LowPart - start;
return ((double)tcnt) / freq;
}
|
|
|
|
|
dear all,
I have dll in which one the function should display a dialog box( this dialogbox resource is in dll)when it called by the aplication ,which has loaded this library (using Loadlibrary()).
But problem here is ,when the application calls this function( which is exported by dll) the dialogbox is not displaying properly and the program stops continuing execution. To solve this i used AFX_MANAGE_STATE(),but when i compile it displayed AFX_MANAGE_STATE is undefined variable( i complied using nmake in SDK platform environment)..
Manjunath S
GESL
Bangalore
|
|
|
|
|
Manjunath S wrote: But problem here is ,when the application calls this function( which is exported by dll) the dialogbox is not displaying properly and the program stops continuing execution.
What do you mean by this? can you be more specific.
Why dont you tried using MFC dll's.
|
|
|
|
|
Actually i have created a dialogbox in an exsisting Dll sample code and tried to display the dialogbox which i have created
But it is giving an error(Err No.1813,Specified Resource type cannot be found in the Image file)
Thanks
Manjunath S
GESL
Bangalore
|
|
|
|
|
can you show code, you have used?
My suggestion would be use MFC dlls otherwise.
|
|
|
|
|
Hi
code is as follows
if((hInst_temp = GetModuleHandle(NULL))==NULL)
{
MessageBox(NULL,"GetModuleHandle error",NULL,MB_OK);
}
if(-1 ==WlxDialogBoxParam(hWlx, hInst_temp,MAKEINTRESOURCE(IDD_DXCAPTURE_DIALOG),NULL, MyCaptureDlgProc, dwInitParam))
{
LPVOID lpMsgBuf;
LPVOID lpDisplayBuf;
DWORD dw = GetLastError();
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL );
lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,
lstrlen((LPCTSTR)lpMsgBuf)+lstrlen((LPCTSTR)"gina")) *sizeof(TCHAR));
wsprintf((LPTSTR)lpDisplayBuf,
TEXT("%s failed with error %d: %s"),
"Gina", dw, lpMsgBuf);
MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK);
LocalFree(lpMsgBuf);
LocalFree(lpDisplayBuf);
}
error number is 1813( ths specified resource type cannot found in image file)
Manjunath S
GESL
Bangalore
|
|
|
|
|
Just an advise, use pre tags for code, its become readable.
Manjunath S wrote: if(-1 ==WlxDialogBoxParam(hWlx, hInst_temp,MAKEINTRESOURCE(IDD_DXCAPTURE_DIALOG),NULL, MyCaptureDlgProc, dwInitParam))
Is it dll code ?
I'm not sure, but its something related to AfxSetResourcehandle, you need to set it right for calling process.
|
|
|
|
|
Hi,
Thanks for your useful response ...
Now its working fine...
I also made a mistake in dialog procedure
Manjunath S
GESL
Bangalore
|
|
|
|
|
|
Greetings brilliant kind and helpful Code Project types! we the lurkers and lowly rabble thank you!
i am using a dialog box as a front end to a flat file databaseon top of a document view SDI
in the dialog, the user adds data to two edit controls (one rich edit - the other just an edit control)
when the user tabs to either edit control, existing text in the control is selected, and if they begin text entry without clearing the slection, the existing text is deleted
the NO Hide Selection check box in the resources editor only clears the selection when the control loses focus
using EN_SETFOCUS (after changing the on_notify to on_en_setfocus in the message map), a pointer to the control and SelSel(0,0) *Works Great In Debug Configuration*, HOWEVER
the RELEASE configuration gives an Access Violatin exception, even without my pointer and SetSel(0,0), whenever you call oninitdialog when the onsetfocus code is present
the debugger provides error cxx0017 error: symbol "this" not found - and the code displayed is in \mfc\src\appmodul.cpp documented as "export winmain to force linkage to thes module"
I hvae also tried using pointer/setsel in other locations without success
Any Suggestions?
how might I change my program so that it is harder for the user to delete existing text which has unwanted selection upon gaining focus to the edit control using the tab key?
Thanks in advance for your time and consideration
"For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." Richard Feynman, Minority Report to the Official Report on the Space Shuttle Challenger Crash
|
|
|
|
|
lctrncs wrote: how might I change my program so that it is harder for the user to delete existing text which has unwanted selection upon gaining focus to the edit control using the tab key?
When the control receives focus, call its SetSel(0, 0) method.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
lctrncs wrote: when the user tabs to either edit control, existing text in the control is selected
This is the default behaviour of the dialog manager. If this is undesirable you should tell the dialog manager, by subclassing the edit control and handling WM_GETDLGCODE[^] to not return the DLGC_HASSETSEL flag (call the base class procedure and mask it out ie. & ~DLGC_HASSETSEL).
lctrncs wrote: using EN_SETFOCUS (after changing the on_notify to on_en_setfocus in the message map),
How did you go about doing this? Using the IDE or manual edits to the message map? EN_SETFOCUS is sent through a WM_COMMAND message, and not a WM_NOTIFY message. The member function signature for both are different. Not sure if this is the problem though as I think the compiler should complain if you made a mistake.
Edit: Link regarding WM_GETDLGCODE http://blogs.msdn.com/oldnewthing/archive/2003/11/14/55678.aspx[^]
-- modified at 15:19 Thursday 24th August, 2006
|
|
|
|
|
hfry - thanx.
your proposed solution looks feasible, and I will give it a try soon
I will have to understand all this subclassing stuff first...
it looks interesting.
You asked about how I changed on_notify and on_en_setfocus
hfry wrote: How did you go about doing this? Using the IDE or manual edits to the message map?
I based my changes on this url
http://support.microsoft.com/default.aspx?scid=kb;en-us;181664[^]
after making the ON_NOTIFY TO EN_SETFOCUS change to the messagemap associated withthe Visual C++ 5.0 and 6.0 bug discussed in the link
I added my pointer/SetSel(0,0) code to the OnSetFocusTheEditControl function
there were no compiler errors
everything worked fine in debug configuration
however, changing to release configuration caused an access violation - with or without my pointer/SetSel(0,0) code whenever the modified function was present
the Microsoft page about the bug also said that you had to have AfxInitRichedit() in your dialog initinstance and modify the message handlers, but I cannot find any difference in the handlers other than the arguments
variations on these themes were not successful either - still the Access Violation in release config when oninit the dialog
A different link suggested that my pointer might be trying to hit the control before it existed - maybe that is the missing "this"? However, the problem occurs even without my pointer
I tried to use the en_killfocus a while back for something else using the same type of messagemap modifications, and had a similar release configuration exception - which forced me to use a different aproach
I wish I understood what the problem is with the modified on_en_setfocus, or better, how to eliminate it in release config and understand it.
I hope this answers your question.
Thanks again.
"For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." Richard Feynman, Minority Report to the Official Report on the Space Shuttle Challenger Crash
|
|
|
|
|