Click here to Skip to main content
15,922,696 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralQuestions on SetProcessAffinityMask Pin
Robert Buldoc11-Apr-03 15:50
Robert Buldoc11-Apr-03 15:50 
GeneralGlobal variable's scope through a solution Pin
Albert Jann11-Apr-03 13:41
Albert Jann11-Apr-03 13:41 
GeneralRe: Global variable's scope through a solution Pin
Nish Nishant11-Apr-03 17:49
sitebuilderNish Nishant11-Apr-03 17:49 
QuestionHow to keep a C++ com dll in memory (repost) Pin
Anonymously11-Apr-03 12:23
Anonymously11-Apr-03 12:23 
AnswerRe: How to keep a C++ com dll in memory (repost) Pin
Daniel Turini11-Apr-03 12:31
Daniel Turini11-Apr-03 12:31 
GeneralRe: How to keep a C++ com dll in memory (repost) Pin
Anonymously12-Apr-03 5:21
Anonymously12-Apr-03 5:21 
GeneralResource Editor gone weird. Pin
JohnMcL11-Apr-03 10:42
JohnMcL11-Apr-03 10:42 
GeneralProblems with MessageBox Pin
mnjobes11-Apr-03 10:26
mnjobes11-Apr-03 10:26 
/*why is it that when i call my msgbox sub-rtn sometimes it will appear behind my dos window and sometimes infront?
here is how i call msgbox.

Libraries used (if related, i don't know; it compiles fine and despite the msgbox problem works fine): stdio.h,stdlib.h,string.h,math.h,conio.h,windows.h,tchar.h
*/
<br />
<br />
HHOOK hMsgBoxHook;<br />
void MsgBoxEnc(void);<br />
LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam);<br />
int MsgBoxEx(HWND hwnd, TCHAR *szText, TCHAR *szCaption, UINT uType);<br />
<br />
void main(void){     //just for sake of argument<br />
     printf("the stuff printed in my program");<br />
     MsgBoxEnc();<br />
     //bunch of stuff happens<br />
     MsgBoxEnc();<br />
}//end main<br />
<br />
LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam)<br />
{<br />
     TCHAR ach[40];<br />
     HWND hwnd;<br />
     HWND hwndButton;<br />
<br />
if(nCode < 0) return CallNextHookEx(hMsgBoxHook, nCode, wParam, lParam);<br />
     switch(nCode){<br />
          case HCBT_ACTIVATE:<br />
          hwnd = (HWND)wParam;<br />
          SetWindowText(hwnd, _T("Message from Creator"));<br />
          hwndButton = GetDlgItem(hwnd, IDOK);<br />
          SetWindowText(hwndButton, _T("OK"));<br />
          return 0;<br />
     }<br />
     return CallNextHookEx(hMsgBoxHook, nCode, wParam, lParam);<br />
}<br />
<br />
int MsgBoxEx(HWND hwnd, TCHAR *szText, TCHAR *szCaption, UINT uType)<br />
{<br />
     int retval;<br />
     hMsgBoxHook = SetWindowsHookEx(<br />
     WH_CBT,<br />
     CBTProc,<br />
     NULL,<br />
     GetCurrentThreadId()  );<br />
<br />
     retval = MessageBox(hwnd, szText, szCaption, uType);<br />
     UnhookWindowsHookEx(hMsgBoxHook);<br />
     return retval;<br />
}<br />
<br />
void MsgBoxEnc(void){<br />
     TCHAR szContents[] = _T("File Encoding is now Complete");<br />
     TCHAR szTitle[]    = _T("File Status");<br />
     MsgBoxEx(NULL, szContents, szTitle, MB_OK | MB_ICONEXCLAMATION);<br />
}<br />

/*In my full program i call the function twice in some sub-rtn and the first time the msgbox will appear behind the dos window; second time, in front!? souldn't the same thing happen both times (which would be worse, i want the box to always be infront)??

Also please remember that i kind of have no idea what's going on(i've never used the windows functions in my programming class, gota love 1st yr Engineering). Mostly the problem is i don't understand the different datatypes used here (nor could i find any info on JUST these datatypes on the net); so this is a collaberation of:

code i found on the net,
code i figured out by searching the STD libraries,
and luck.

p.s. if someone could tell me where to learn EXACTLY what happens here, i would be really grateful. thanks for your time.*/
QuestionHi, Maximilien. I'm hkbeckham. Could I have your email addres? Pin
hkbeckham11-Apr-03 9:02
hkbeckham11-Apr-03 9:02 
GeneralClear Files Pin
gmlnd11-Apr-03 8:36
gmlnd11-Apr-03 8:36 
GeneralRe: Clear Files Pin
Brian Shifrin11-Apr-03 20:53
Brian Shifrin11-Apr-03 20:53 
GeneralBitmapButton Pin
bumper11-Apr-03 8:01
bumper11-Apr-03 8:01 
GeneralRe: BitmapButton Pin
Big Art13-Apr-03 7:45
Big Art13-Apr-03 7:45 
Question:confused::confused:How to create a vertical CTabCtrl control?? Pin
psusong11-Apr-03 7:52
psusong11-Apr-03 7:52 
AnswerRe: :confused::confused:How to create a vertical CTabCtrl control?? Pin
Ravi Bhavnani11-Apr-03 9:38
professionalRavi Bhavnani11-Apr-03 9:38 
GeneralRe: :confused::confused:How to create a vertical CTabCtrl control?? Pin
psusong11-Apr-03 11:47
psusong11-Apr-03 11:47 
GeneralFont Coloring Preview Pin
Jonah Bishop11-Apr-03 6:56
Jonah Bishop11-Apr-03 6:56 
GeneralRe: Font Coloring Preview Pin
Ravi Bhavnani11-Apr-03 7:06
professionalRavi Bhavnani11-Apr-03 7:06 
GeneralRe: Font Coloring Preview Pin
Jonah Bishop11-Apr-03 7:40
Jonah Bishop11-Apr-03 7:40 
GeneralC++ tokenizer Pin
naja11-Apr-03 6:05
naja11-Apr-03 6:05 
GeneralRe: C++ tokenizer Pin
Toni7811-Apr-03 22:50
Toni7811-Apr-03 22:50 
QuestionHow can I get the IP of my server? Pin
Salvador Dali11-Apr-03 5:17
Salvador Dali11-Apr-03 5:17 
AnswerRe: How can I get the IP of my server? Pin
Peter Weyzen11-Apr-03 6:35
Peter Weyzen11-Apr-03 6:35 
GeneralRe: How can I get the IP of my server? Pin
Salvador Dali11-Apr-03 7:17
Salvador Dali11-Apr-03 7:17 
GeneralRe: How can I get the IP of my server? Pin
Peter Weyzen11-Apr-03 7:28
Peter Weyzen11-Apr-03 7:28 

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.