|
|
Hi Gurus,
I log an event with event type as 0 ( EVENTLOG_SUCCESS ). In event viewer the event has the Information icon. But when I open the properties window for the event, the Type is displayed as None. Why?
Thanks
C++beginer
|
|
|
|
|
Logging to the event log isn't easy, especially if you want to follow the rules and get a nice looking log.
I suggest you search for articles (here on CP) on the subject.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
See here[^] maybe it is some helpful to you
|
|
|
|
|
I have gone through these articles. In winnt.h the event types are given as
#define EVENTLOG_SUCCESS 0X0000
#define EVENTLOG_ERROR_TYPE 0x0001
#define EVENTLOG_WARNING_TYPE 0x0002
#define EVENTLOG_INFORMATION_TYPE 0x0004
#define EVENTLOG_AUDIT_SUCCESS 0x0008
#define EVENTLOG_AUDIT_FAILURE 0x0010
Still if I log an event with event type value as zero, Success is not shown as the type in EventViewer. Thats what I do not understand.
C++beginer
|
|
|
|
|
|
It seems only error, information, warning, audit_success and audit_failure can be used as event types for logging. They what is the purpose of EVENTLOG_SUCCESS in winnt.h?
C++beginer
|
|
|
|
|
Hello
I have a viewer written in VC++ and OpenGl which will load and show the building models. Initially the model was designed to draw every floor in the center of the screen and then translate (shift) while drawing the next floor. Thus the display will always be centered.
I am trying to change this behaviour as the translation for every floor is a huge overhead for a large models. So I chose a co-ordinates to start with and then it builds the model. However once it is complete i want to move the model to the center which I am not able to do. I tried the following:
glPushMatrix();
glMatrixMode(GL_MODELVIEW);
glTranslatef(-8.0, -8.0, -8.0);
RedrawWindow(NULL,NULL,RDW_UPDATENOW|RDW_INVALIDATE);
glPopMatrix();
I am not sure how to determine the center of the screen. Theoretically it should be, say for x, Near_Left_Bottom_Point.x + Far_Right_Top_Point.x)/2.0
and so on.
but I am not sure how to obtain the Near_Left_Bottom_Point.x.
Any pointers would be much helpful!
Thanks in advance
Jam
|
|
|
|
|
From studying various piecs of code and books, I inferred the following is the very basic code needed for a thread. Will it create and run a thread? If so, will ScheduleThreadProc continue to iterate without any form of coded loop? Thanks.
void CSchedule::startLoop()
{
AfxBeginThread(ScheduleThreadProc, this);
}
UINT ScheduleThreadProc( LPVOID pParam )
{
****my code here***
return 0;
}
|
|
|
|
|
Hello,
Oliver123 wrote: Will it create and run a thread?
Yes.
Oliver123 wrote: If so, will ScheduleThreadProc continue to iterate without any form of coded loop
No, the thread function is just like any function. It runs from begining to end. After it returns, the thread terminates. To keep the thread running, your ****my code here*** should define a loop.
Best,
Jun
|
|
|
|
|
There are two types of Threads:
1) User Interface Threads:
User-interface threads are commonly used to handle user input and respond to events and messages generated by the user.
For creating a user-interface thread derive a class from CWinThread.Then use RuntimeClass in the AfxBeginThread().
2) Worker Threads:
Worker threads are commonly used to complete tasks, such as recalculation, that do not require user input.
Creating a worker thread is a relatively simple task. Only two steps are required to get your thread running: implementing the controlling function and starting the thread.
This is what you are doing here. Creating a worker thread
Oliver123 wrote: Will it create and run a thread
Yes this will Create a thread and the control is transferred to ThreadProc.
Avoid using Terminate Thread etc when you do want to exit from a thread. Always return from the thread function.
Oliver123 wrote: without any form of coded loop
You need to have a loop in the thread function.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
And see here[^] maybe it is some helpful to you
|
|
|
|
|
Thanks. I put a for()loop with a sleep() and beep in the thread, and it beeps ten times just like it should.
|
|
|
|
|
Sorry for the stupid question, but i can't remember how and everything i tried didn't worked.
I tried: != "" , != "\0" , != String::Empty , and a lot more that didn't worked at all.
by the way i'm using visual studio 2003.
|
|
|
|
|
If I remmeber, the return value of SendMessage() is the number of characters copied to the string. Also before getting the text, you are supposed to set the first character in the buffer to the size of the buffer, so comparing to NULL is not going to work, you should check if it changed at all.
|
|
|
|
|
I'm not sure i'm following you, but you made me think to compare the length of the string to not 0 and it's working perfectly.
BTW to be sure we were talking of the same thing an editbox is a field you enter text in it and you access the text with ControlName->Text.
|
|
|
|
|
You MFCer's!! In plain win 32 we send a message to the edit box EM_GETLINE, but before sending that we must allocate a char* and set the first char to the size of the memory we just allocated. ie:
char tmp[128];
tmp[0] = '128';
int len = SendMessage(hEdit,EM_GETLINE,0,(long)tmp);
if (len == 0)
|
|
|
|
|
Ahhhh. That makes more sense.
|
|
|
|
|
What's wrong with sending the edit control a WM_GETTEXTLENGTH message?
"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
|
|
|
|
|
Hello everyone!
Here, I have this statement:
#pragma once<br />
<br />
#include "Includes.h"<br />
<br />
class Game<br />
{<br />
Player mainPlayer;
<br />
VehicleType AllVehicles[1];
It generates these errors:
1>[dir]\Game.h(10) : error C2146: syntax error : missing ';' before identifier 'mainPlayer'<br />
<br />
1>[dir]\Game.h(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int<br />
<br />
1>[dir]\Game.h(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Why would it be? I'm pretty sure it's just some bad syntax I didn't see, that's why I included the surrounding lines... Any ideas? Thanks!
PS: Here's the declaration of Player :
#pragma once<br />
<br />
#include "Includes.h"<br />
<br />
class Player<br />
{<br />
int color;<br />
<br />
public:<br />
Player();<br />
<br />
SDL_Surface *surf;<br />
<br />
int x, y;<br />
<br />
bool Load(int color);<br />
<br />
bool SwapColors(SDL_Surface *surf, int color);<br />
};<br />
Windows Calculator told me I will die at 28.
|
|
|
|
|
#include "Player.h"
led mike
|
|
|
|
|
I think you are getting errors because you did not #include "Player.h" in Game.h . As you are creating an object of Player , therefore, the compiler should know what Player is.
Alternatively, you could try this syntax: (not always guaranteed to work)
class Player;
at the top of Game.h and #include "player.h" in Game.cpp .
this is this.
|
|
|
|
|
|
How about:
#pragma once<br />
<br />
#include "Player.h"<br />
<br />
class Game<br />
{<br />
...
Because includes.h is already included in Player.h . It should work.
this is this.
|
|
|
|
|
I am adding a single property page class to a property sheet a variable number of times in a modal dialog. Ideally I would like to adjust the tab caption from within the property page in response to a user adjustment to a caption edit field. Barring that, I would at least like to uniquely set the caption for each tab in OnInitDialog() or OnShowWindow() or from the property sheet on dialog startup. Calls to SetWindowText() seem to be happily ignored by the property page in those locations. Anybody have any experience/luck with this sort of thing?
Thanks in advance,
Scott
-- modified at 17:21 Monday 28th August, 2006
-- modified at 17:22 Monday 28th August, 2006
Scott P. Chapman
Voss Scientific Inc.
scottc@vosssci.com
|
|
|
|