Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Ask for help ___the errors in my projects to show non-model dialog in dll Pin
zhu_lin16-Aug-09 22:29
zhu_lin16-Aug-09 22:29 
GeneralRe: Ask for help ___the errors in my projects to show non-model dialog in dll Pin
hailuolan19-Aug-09 2:46
hailuolan19-Aug-09 2:46 
AnswerRe: Ask for help ___the errors in my projects to show modless dialog in dll Pin
zhu_lin20-Aug-09 15:26
zhu_lin20-Aug-09 15:26 
GeneralRe: Ask for help ___the errors in my projects to show modless dialog in dll Pin
hailuolan21-Aug-09 4:21
hailuolan21-Aug-09 4:21 
QuestionExtending combo box. [modified] Pin
emmmatty114-Aug-09 19:30
emmmatty114-Aug-09 19:30 
AnswerRe: Extending combo box. Pin
Code-o-mat14-Aug-09 21:17
Code-o-mat14-Aug-09 21:17 
GeneralRe: Extending combo box. Pin
emmmatty114-Aug-09 22:33
emmmatty114-Aug-09 22:33 
QuestionGCC & bitmap.c__ Pin
tuan111114-Aug-09 18:29
tuan111114-Aug-09 18:29 
AnswerRe: GCC & bitmap.c__ Pin
zhu_lin16-Aug-09 16:23
zhu_lin16-Aug-09 16:23 
QuestionGCC & vga,bitmap.c Pin
tuan111114-Aug-09 17:13
tuan111114-Aug-09 17:13 
AnswerRe: GCC & vga,bitmap.c Pin
Bacon Ultimate Cheeseburger14-Aug-09 17:29
Bacon Ultimate Cheeseburger14-Aug-09 17:29 
AnswerRe: GCC & vga,bitmap.c Pin
Bacon Ultimate Cheeseburger14-Aug-09 20:33
Bacon Ultimate Cheeseburger14-Aug-09 20:33 
QuestionVC7 to VC8 migration Pin
uli200014-Aug-09 9:01
uli200014-Aug-09 9:01 
AnswerRe: VC7 to VC8 migration Pin
«_Superman_»14-Aug-09 17:05
professional«_Superman_»14-Aug-09 17:05 
QuestionTVINSERTSTRUCT - how to get the "item" memeber in CTreeCtrl? Pin
Vaclav_14-Aug-09 8:49
Vaclav_14-Aug-09 8:49 
AnswerRe: TVINSERTSTRUCT - how to get the "item" memeber in CTreeCtrl? Pin
Vaclav_14-Aug-09 8:53
Vaclav_14-Aug-09 8:53 
QuestionLogger! "hijacking" interface! Pin
thelonesquirrely14-Aug-09 7:27
thelonesquirrely14-Aug-09 7:27 
Heya,

So I have to write a logger that emulates log4cxx, without all the awesome features. The main problem I am having is that it needs to be able to be accessed through a Macro with variable args. The Macro has to take variable args of different, unspecified types. I am not sure how this happens. I think I am going to have to rely on the compiler at some point, but I am stumped.

It is easier to show:
the macro:
LOG (Message m, ...)

the Message m comes from an enum (gen'd from xml). It is used like this:
LOG (UNEXPECTED_EVENT, "thread failure");
<< ERROR: UNEXPECTED EVENT: thread failure
LOG (TRACE);
<< TRACE
LOG (DEBUG_MESSAGE, "At line ", line);
<< DEBUG_MESSAGE: At line 7

The types and such are not specified. The format of the message coming out IS though. But it is missing type information.

In the XML the fmt strings are specified like this:
88     <item>
89       <message>CS_CommandHandlingUnknownException</message>
90       <severity>ERROR</severity>
91       <text>An exception was thrown while processing command %1%</text>
92     </item>


I am having problems doing a type-discovery. I am using the va_args structure to get the arguments from the macro:
59   void WriteToLog (Message m, ...)
60   {
61     va_list vlist;
62     char *cur_arg;
63     MessageBody msg_body = msg_map [m];
64
65     va_start (vlist, m);
66
67     for (int i = 0; i < msg_body.fmt_strings.size (); i++)
68     {
69       cur_arg = va_arg (vlist, char *);
70       std::cout << msg_body.fmt_strings[i] << " ";
71       std::cout << "'" <<  cur_arg << "'" << std::endl;
72
73     }
74   }


The msg_body is simply a container for the XML. I parsed out the sections of the string, so that they coincide with the number of args (cause if i didn't know how many args then all hell breaks loose).

Because I have to specify a type in the va_arg I am able to pull off char* fine, but everything else causes segfaults. any ideas on how to get this working? I think it might be time to go back to the drawing board. The one thing I can't change is the macro, nor the XML (le sad Frown | :( . Thanks in advance.
AnswerRe: Logger! "hijacking" interface! Pin
thelonesquirrely14-Aug-09 8:36
thelonesquirrely14-Aug-09 8:36 
QuestionHow to get tool tip text of another application. Pin
onlyjaypatel14-Aug-09 4:27
onlyjaypatel14-Aug-09 4:27 
AnswerRe: How to get tool tip text of another application. Pin
Bacon Ultimate Cheeseburger14-Aug-09 11:26
Bacon Ultimate Cheeseburger14-Aug-09 11:26 
GeneralRe: How to get tool tip text of another application. Pin
onlyjaypatel14-Aug-09 19:29
onlyjaypatel14-Aug-09 19:29 
QuestionSet TitleBAr Pin
kumar sanghvi14-Aug-09 2:52
kumar sanghvi14-Aug-09 2:52 
AnswerRe: Set TitleBAr Pin
kumar sanghvi14-Aug-09 3:45
kumar sanghvi14-Aug-09 3:45 
QuestionRe: Set TitleBAr Pin
David Crow14-Aug-09 5:39
David Crow14-Aug-09 5:39 
GeneralRe: Set TitleBAr Pin
Bacon Ultimate Cheeseburger14-Aug-09 11:52
Bacon Ultimate Cheeseburger14-Aug-09 11:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.