|
hi all,
i need a *good* tutorial regarding use of MFC's, especially in the graphics drawing context. I'm TOTALLY lost between UpdateAllViews, OnUpdate, OnDraw, OnPaint, etc etc etc, coz' i can't grasp the concepts behind it all. i mean, what's the link up between all this stuff? please tell me if there's a tutorial on the web that clarifies all these concepts. yhanks.
imran.
help me today, and may be i'll help you out tomorrow... (yeah, it doesn't seem too likely right now, i guess!)
|
|
|
|
|
I don't know of one on the web, but I have a book called Beginning Visual C++ by Ivor Horton (I think --
it's not here with me; I believe it is published by SAMS press) that helped me a lot.
It does a really good job of explaining the basics of MFC
and then gets into some really good examples to illustrate what's going on.
The main example in the book is a basic drawing program that I think would do a good job of
explaining the stuff you say you are having trouble with.
It's a few years old, so I don't know if you can still find it. I hope you can because it's a really
good book.
|
|
|
|
|
"Beginning Visual C++ 6" by Ivor Horton.
Wrox Press Inc; ISBN: 186100088X (it's not SAMS like I thought).
I found it just now on Amazon, so I know it's still available ($40).
|
|
|
|
|
This one is really good.....try it.....
http://devcentral.iftech.com/learning/tutorials/submfc.asp
|
|
|
|
|
my code goes like this:
struct myStruct
{
CString m_string;
int m_integer;
char* m_pchar;
}
void func()
{
myStruct* s;
s->m_string = "a string";
s->m_integer = 1;
s->m_pchar = "a string too";
}
apparently the pointer s is uninitialised. how can I make this code work?
|
|
|
|
|
struct myStruct
{
CString m_string;
int m_integer;
char* m_pchar;
};
void func()
{
myStruct *s;
s=malloc(sizeof(myStruct)); //this is the key line..
s->m_integer=1; //.. blah blah
remember to free(s); at the end!
You need to initialise a memory space for the 'struct'. Another way to do this would be to NOT declare it as a pointer.
Hope this helps. I also hop i havent made any silly mistakes.. I am away froma compiler!
|
|
|
|
|
Unless you are using C, please do not use malloc - use new/delete instead. Among other things, it means you get a destructor which is called on delete. This, in turn, means your class can clean up after itself. Replace malloc with
myStruct* s = new myStruct;
at the end
delete s;
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
Oops, yes... sorry about that.
Saw a 'struct', assumed C...
My Fault.;)
|
|
|
|
|
Hi,
We use several custom file formats for storing video data in various formats. I want to write a source filter that will allow me to read in the file and output yuv (for example). I have no problem reading in the data or changing the format. I do however need some help on how to write a source filter. Can anyone give me some pointers
Cheers,
Nick
|
|
|
|
|
I writing an app which should bring itself to top upon a particular internal event. I managed to make it the toplevelwindow, but I found no way to make it have the input focus, neither the button in the taskbar to get selected.
This is my final code:
if (RNEWMESS)
{
if (pMain->IsIconic())
pMain->ShowWindow(SW_RESTORE);
pMain->SetWindowPos(&CWnd::wndTop,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
pMain->SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
pMain->SendMessage(WM_ACTIVATEAPP,(WPARAM)TRUE,(LPARAM)this->m_nThreadID);
pMain->SendMessage(WM_ACTIVATE,WA_ACTIVE);
pMain->ActivateFrame();
pChild = (CPMCFrm*) pMain->GetActiveFrame();
if (pChild)
{
pChild->ActivateFrame();
pChild->SetFocus();
pChild->SetActiveWindow();
CView* pView = pChild->GetActiveView();
if (pView)
{
pView->SetActiveWindow();
pView->SetFocus();
}
}
}
Anybody has some suggestions?
|
|
|
|
|
Call CWnd::SetForegroundWindow, which is a wrapper over API SetForegroundWindow. There are several restrictions on setting the foreground window, especially on Win2000 - you can find the details in MSDN docs on SetForegroundWindow (Platform SDK: Windows User Interface).
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thanks!
It works fine for Win95 and NT4, but on Win2000 I had no success. Although I have applications running (on Win2000) that manage to switch themselves to the foreground. I wonder how they do that...
Daniel Schmid
|
|
|
|
|
Dan I do not have an answer for you. But I have been working on the same problem for two days. SetForeground() does not always work, especially if some other app has a system modal message displayed.
If I find the answer, I will email you. And if you find the answer, would you please email me.
Phil
at
LynnPhil@Qwest.net
|
|
|
|
|
Hello,
Im sure this has been asked before but i couldnt find it in any of the recent post.
I am looking for a good online tutorial over MFC network Programing. Either with CSocket or
CAsyncSocket.
It appears this tutorial needs to be written for a dummy cuase I've gone through Several Sample Apps and MSDN and Cant get seem to get it down.
If it was a simple chat server/client like the one included in MSDN, but with the CSocket stuff explained a little it would be perfect.
If you know of a tut like that please respond.
Thanks for any help,
HAM
|
|
|
|
|
I want to bring on top a browse item dialog box when login to my app is successful while my main frame window is hide but I can't.
Thanks for your assistance.
Do Quyet Tien
|
|
|
|
|
The main window not being visible stops SetWindowPos from working ? If you've not tried that, in your dialog it's
SetWindowPos (&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOZORDER);
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
|
Hello, the codegurus around the world.;) (Copy Right 2001 Masaaki Onishi)
SetWindowPos didn't work in OnInitDialog to hide its own dialog.
But, MoveWindow works.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Make the dialog box modeless.
|
|
|
|
|
Is it possible to use DateTimePicker
control in non-MFC Win32 application?
|
|
|
|
|
The DTP control is a built-in common control, as long as you have an updated comctl32.dll, so yes it's possible.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
I want to change the appearance of the scroll bar in a List View
Control.
1.How can I change a scrollbar palette?
The following code doesn't work:
InitializeFlatSB(hListViewWindow);
FlatSB_SetScrollProp(hListViewWindow,WSB_PROP_PALETTE,(int)palette,false);
2. The following code also doesn't do anything:
FlatSB_SetScrollProp(hListWindow,WSB_PROP_CYVTHUMB,10,false);
3. Is it possible to make an appearance of the scroll bar in a List View
Control based on bitmaps?
|
|
|
|
|
How can I set a bitmap on List View Control's background. And I need
to make it the way that when the user scrolls the list, bimap must
stay on it's place and doesn't scroll with the list.
|
|
|
|
|
Handle the WM_ERASEBKGND message. Of course, you have to implement all bitmap painting manually, there's no magic 'SetBackgroundBitmap' call
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I cannot modify by turn off WS_VISIBLE in PreCreateWindow, neither call ShowWindow(SW_HIDE) in OnCreate, window will hide but it still flash once before hide.
Thanks for your assistance.
Do Quyet Tien
|
|
|
|