Click here to Skip to main content
16,007,885 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCommunication with the existing driver Pin
Paresh emb29-Aug-05 3:27
Paresh emb29-Aug-05 3:27 
QuestionFormatting in the Rich Edit Control Pin
Dave Kerr29-Aug-05 3:25
Dave Kerr29-Aug-05 3:25 
Questionwho can tell me what fomat the audio file *.ssu is. Pin
wpjob29-Aug-05 2:24
wpjob29-Aug-05 2:24 
Answerthe data in the file is: Pin
wpjob29-Aug-05 2:28
wpjob29-Aug-05 2:28 
JokeRe: the data in the file is: Pin
toxcct29-Aug-05 2:41
toxcct29-Aug-05 2:41 
GeneralRe: the data in the file is: Pin
Jörgen Sigvardsson29-Aug-05 11:03
Jörgen Sigvardsson29-Aug-05 11:03 
AnswerRe: who can tell me what fomat the audio file *.ssu is. Pin
Cedric Moonen29-Aug-05 3:03
Cedric Moonen29-Aug-05 3:03 
QuestionThread problems... Pin
Lefteris_RG312029-Aug-05 2:21
Lefteris_RG312029-Aug-05 2:21 
Hello guys!I've been coding MFC apps for 3 months now,and i recently encountered the situation below:

I have a Dialog window (class CControlPanelDlg) and a picture control object called m_pcTest(of type CStatic).I have created a structure called "Bitmap" that contains the following array : CBitmap Icon[4].I've created 4 bitmap images and loaded them into Icon(Using LoadBitmap(IDB_IMAGE_ID) method).I want to change the image that m_pcTest shows each time i click a Button within the window(using m_pcTest.SetBitmap(Bitmap.Icon[0])).So far so good.The image changes.Then i created a thread,that it's thread function calls another function located inside CControlPanelDlg.cpp,the same function i use to change the image shown in m_pcTest every once i click the button.While in Debug mode,i noticed that when the program jumps inside the function that change images (m_pcTest.SetBitmap(Bitmap.Icon[0])),the variable m_pcTest has the following value:
m_pcTest={CStatic hWnd=???}. When the program passes the line that contains the breakpoint,it throws a nasty Access Violation!I tried calling tha function from within the thread function with different ways,like:

((CControlPanelDlg*)AfxGetApp()->m_pActiveWnd)->ChangeImage();
p_ControlPanelDlg ->ChangeImage();

(p_ControlPanelDlg ---> external pointer to CControlPanelDlg dialog class)

The variable m_pcTest is public.Am i doing something wrong?Did i forget to declare something?Or i declared it in the wrong way?Please help.I know i'm new to MFC,and you probably going to ask yourself "why this young lad bothers himself with threads so early"? The answer is i'm in love with MFC and i've learned so much within those 3 months(mostly Serial Communication,Database projects) and i needed to learn how to change bitmaps while other code was executing.I tried to do this with timers but as long as my code enters a loop,ChangeImage()could not be called until code execution continued beyond the loop.I tried UpdateData(FALSE)from inside the loop,but nothing happend.So i needed a co-process,a thread.I would appreciate it if someone of you code gurus out there could help.Thank GOD that "The Code Project" exists as my homepage...

Lefteris_RG3120
Control Systems & Software Engineer

-- modified at 8:23 Monday 29th August, 2005
AnswerRe: Thread problems... Pin
Jose Lamas Rios29-Aug-05 3:06
Jose Lamas Rios29-Aug-05 3:06 
QuestionSimple Question (sorry 4 the trouble again) :) Pin
Eytukan29-Aug-05 2:16
Eytukan29-Aug-05 2:16 
AnswerRe: Simple Question (sorry 4 the trouble again) :) [EDITED] Pin
toxcct29-Aug-05 2:22
toxcct29-Aug-05 2:22 
GeneralRe: Simple Question (sorry 4 the trouble again) :) Pin
Achim Klein29-Aug-05 2:35
Achim Klein29-Aug-05 2:35 
GeneralRe: Simple Question (sorry 4 the trouble again) :) Pin
toxcct29-Aug-05 2:37
toxcct29-Aug-05 2:37 
GeneralRe: Simple Question (sorry 4 the trouble again) :) [EDITED] Pin
Eytukan29-Aug-05 2:49
Eytukan29-Aug-05 2:49 
GeneralRe: Simple Question (sorry 4 the trouble again) :) [EDITED] Pin
Bob Stanneveld29-Aug-05 4:06
Bob Stanneveld29-Aug-05 4:06 
AnswerRe: Simple Question (sorry 4 the trouble again) :) Pin
Achim Klein29-Aug-05 2:31
Achim Klein29-Aug-05 2:31 
GeneralRe: Simple Question (sorry 4 the trouble again) :) Pin
Eytukan29-Aug-05 2:49
Eytukan29-Aug-05 2:49 
Questionproxy settings Pin
Member 217784029-Aug-05 1:43
Member 217784029-Aug-05 1:43 
AnswerRe: proxy settings Pin
toxcct29-Aug-05 2:00
toxcct29-Aug-05 2:00 
GeneralRe: proxy settings Pin
Member 217784029-Aug-05 21:47
Member 217784029-Aug-05 21:47 
Questionpreview problems Pin
mikobi29-Aug-05 1:23
mikobi29-Aug-05 1:23 
Questionpreview problems Pin
mikobi29-Aug-05 1:15
mikobi29-Aug-05 1:15 
AnswerRe: preview problems Pin
Member 214363829-Aug-05 4:20
Member 214363829-Aug-05 4:20 
GeneralRe: preview problems Pin
mikobi29-Aug-05 19:37
mikobi29-Aug-05 19:37 
GeneralRe: preview problems Pin
Member 214363829-Aug-05 21:26
Member 214363829-Aug-05 21:26 

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.