|
Hi All,
I want to create a dll (well I actually already started) which creates and writes messages to a .log file. My problem is I need to beable to have any dlls/threads that are called by the application to write into the filelog. What do I need to do to ensure that all the information gets written to the file log? Because If I initialize the file in the Application, But then have a MessageLog call from a dll that has been loaded into the App's memory space, that message does not get written to the log.
I'm not quite sure what to do here. I know it has something to do with the application's memory space and also with Threads and semaphores and critical data.... But I'm not really sure what I need to do.
Any suggestions on this matter are greatly appreciated.
Thanks Alot!
Dan
|
|
|
|
|
It sounds like you should put all the file handling in the log DLL. You should also use mutexes when there can be more than one that calls the logging function.
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
check out my winsock hooking article ! you`ll get and idea or two
//read it
//rate me or hate me
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
Im my ListView control I want to catch the event when an item is selected, or when user selects new item with arrowkeys, or when NO item is selected. This can all be catched with OnItemChanged event, or with the OnItemChanging event.
However, the OnItemChanged event is called THREE times when switching from one item to another. By catching the event with a messagebox, I determined what happens when changing items:
[item0 is selected]
-> User selects item1
-> [1st call OnItemChanged], the itemindex is item0 and no. of items selected is 1
-> [2nd call OnItemChanged], the itemindex is item0, no. of items selected is 0
-> [3rd call OnItemChanged], the itemindex is item1, no. of items selected is 1
[item1 is selected]
I want to display a preview form in my lower CSplitterwnd, which is dependant on the type of selected item. So now, the form updates THREE times, because the OnItemchanged event is called three times. I can reduce it to two times, but this shouldn't be happening at all I think.
The OnItemChanging event is called FOUR times, but that makes sense for this event.
Why is OnItemChanged not called ONE time, AFTER the item is changed?
Should I use another event?
|
|
|
|
|
shoot wrote:
Why is OnItemChanged not called ONE time, AFTER the item is changed?
1. because the first item is changing from selected to non-selected
2. not sure, maybe it tells you when 'nothing' gets selection
3. because the new item is getting selection
you might try testing the uNewState member of the NVLISTVIEW struct and only react when the item is changed to LVIS_SELECTED
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
I've used this...
/////////////////
/////////////////
/////////////////
if ((pNMListView->iItem != this->m_iElementSeleccionatAnt) && (pNMListView->iItem != -1))
{
this->m_iElementSeleccionatAnt = pNMListView->iItem;
if (this->m_cLCtrlParametritzacions.GetItemState(pNMListView->iItem, LVIS_SELECTED) == LVIS_SELECTED)
{...
/////////////////
/////////////////
/////////////////
"this->m_iElementSeleccionatAnt" is a static var that holds the last involved item during the last call to OnItemChanged...
Then I check the selection state...
hope this helps...
PS:
Although the above code can help you (at least this is what I expect...)...
I was trying to control some kind of edition in my listCtrl and it was also called several times...
I've finished controlling mouse clicks and enter key in a listctrl derived control... You will be able to control any key press and so on in a derived class...
|
|
|
|
|
Hi,
Does MSDE support Stored Procedures, and... well all that good things that should have a database engine and Ms Access does not have ....
I saw an article from Christian Grauss "GUI tool to help developers use the MSDE database", I saw a comment saying that there were a web tool to manage MSDE but the link now doesn't exist anymore, can somebody point me to that ?
Thanks, Greetings
Braulio
|
|
|
|
|
Hi all,
I have a rather strange requirement of establishing two dial-up connections through two external modems connected to my machine at the same time. The real problem is that I have to support browsing for each connection separately at the same time. I cannot use IE as the connection setting is global.
I have been looking at various options like programmatic dialing using RAS, using browser control etc but in vain. Has anyone encountered this kind of problem before? Any pointers please?
Thanks in advance,
krnathan
|
|
|
|
|
dear all,
how can i detect whether the OS installed is Windows Xp , Windows 2000 or windows NT
Also can i get some info about the service pack installed
thanx
Regards,
|
|
|
|
|
|
Isn't it GetOSVersionEx()?
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
enum OS_TYPE{
OS_WIN_32s,
OS_WIN_NT3,
OS_WIN_95,
OS_WIN_98,
OS_WIN_ME,
OS_WIN_NT4,
OS_WIN_2000,
OS_WIN_XP
};
unsigned int GetOSType()
{
OS_TYPE ShellType;
DWORD winVer;
OSVERSIONINFO *osvi;
winVer=GetVersion();
if(winVer<0x80000000){/*NT */
ShellType=OS_WIN_NT3;
osvi= (OSVERSIONINFO *)malloc(sizeof(OSVERSIONINFO));
if (osvi!=NULL){
memset(osvi,0,sizeof(OSVERSIONINFO));
osvi->dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
GetVersionEx(osvi);
if(osvi->dwMajorVersion==4L)ShellType=OS_WIN_NT4;
else if(osvi->dwMajorVersion==5L&&osvi->dwMinorVersion==0L)ShellType=OS_WIN_2000;
else if(osvi->dwMajorVersion==5L&&osvi->dwMinorVersion==1L)ShellType=OS_WIN_XP;
free(osvi);
}
}
else if (LOBYTE(LOWORD(winVer))<4)
ShellType=OS_WIN_32s;
else{
ShellType=OS_WIN_95;
osvi= (OSVERSIONINFO *)malloc(sizeof(OSVERSIONINFO));
if (osvi!=NULL){
memset(osvi,0,sizeof(OSVERSIONINFO));
osvi->dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
GetVersionEx(osvi);
if(osvi->dwMajorVersion==4L&&osvi->dwMinorVersion==10L)ShellType=OS_WIN_98;
else if(osvi->dwMajorVersion==4L&&osvi->dwMinorVersion==90L)ShellType=OS_WIN_ME;
free(osvi);
}
}
return ShellType;
}
//rate me or hate me
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
Is there any way to me to start a process and then call one of its functions or pass variables over to it? So far all i can do is WinExec(...), im guessing i have to have the handle of the new process or something
|
|
|
|
|
What do you mean "call its functions" ?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
You have several ways to do it
a. Windows messages (you have to know window handle)
b. COM
c. Sockets/pipes
d. Synchronization primitives like Event/Mutex
e. Memory mapped files
|
|
|
|
|
check out my api hooking revealed - winsock hook article ! it will show you how to inject a dll in eanother process !
then call any function
//have fun
//rate me or hate me
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
;PHere's an interesting question...
What are the consequences of creating windows (by using either Create(..) or DoModal() in a worker thread. Since a worker thread has no message queue and AfxGetMainWnd() returns the window associated with the thread, how will it work? Should it work? What are the effects?
The reason I'm asking, is I've noticed some part of the program I'm been assigned to create windows in worker threads. I know the best way is to create a GUI thread and assign the m_pMainWnd variable to the created window. I really just want to know the effects of windows in worker threads.
Regards,
GeMe_Hendrix
|
|
|
|
|
Try AfxMessageBox("Some message")?
If it works, it is good.
===========================
My home is www.brigsoft.com
|
|
|
|
|
Yeah, thanks for that comprehensive answer to the complex subject of multithreading and message queueing that I was trying to find out about.
|
|
|
|
|
Hi all,
I have a question regarding DevStudio add-ins:
Is it possible to enable/disable, or even change, buttons in an add-in command bar? If it is - how?
Thanks,
/Henrik
|
|
|
|
|
Hello everyone
m_listkiezers is a CListCtrl.
at: DWORD dwExStyle = m_listkiezers.GetExtendedStyle();
i get the following error:
error C2039: 'SetExtendedStyle' : is not a member of 'CListCtrl'
I searched for the class members for CListCtrl and 'SetExtendedStyle' was in it but it won't accept it.
Can anyone help me?
Thanks
Jens
|
|
|
|
|
You're talking of a compilation error for the following snippet, say.
CListCtrl mylist;
DWORD dwExStyle = mylist.GetExtendedStyle();
It should compile fine. I'm confused by the mismatch between Set and Get in your question though, are you sure there isn't a typo in your code?
Debbie
|
|
|
|
|
Hi Debbie
Here's the whole function:
void CDlgM4_1::SetGridLines()
{
DWORD dwExStyle;
dwExStyle = m_listkiezers.GetExtendedStyle();
DWORD dwStyle = m_listkiezers.GetStyle();
//Stijlen wijzigen zoals je ze wilt
//dwStyle |= LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER;
//dwExStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES;
//Nu veranderingen toepassen:
//m_listkiezers.ModifyStyle(0,dwStyle);
//m_listkiezers.SetExtendedStyle(dwExStyle);
}
m_listkiezers is the name of the control attached to the list control
i don't c the problem but it still gives me the error on that line
|
|
|
|
|
I just declared a local
CListCtrl listkiezers;
in the above code and it compiles fine on my box (VC++ 6.0)
Maybe the compiler is kicking up about a problem that is somewhere else in your code? You could try isolating it?
Debbie
|
|
|
|
|
i still use VC++5.0 maybe that's the problem
by the way, doesn't work with a local one neither
Greetz
Jens
|
|
|
|