|
OMG, I can't believe that I didn`t think of trying that... I was always trying put the (HBITMAP) in the second parameter of the SelectObject(hdc, (HBITMAP) blah); If I would haver thought of that one, I could have went without wasting space on this forum...
thanks a lot, that's one less headache.
|
|
|
|
|
Re: #2 and #3
2.) Sure, you can have both 'c' and 'cpp' files in the same project. The linker only complains when you use a C-compiled function inside a C++ chunk of code. In that case you could use extern "C" {} wrapper in the C++ code.
3.) C programming for windows typically involves the Windows SDK without any wrappers to hide its complexity. There is no inheritance hiearchy to worry about so its easier to understand when you don't know object-oriented programming (OOP) so well.
C++ programming for windows involves understanding the inheritence mechanism and that, for instance, in MFC, a CDialog has its member functions *plus* the CWnd member functions and so on.
In general, C++ makes the implementation of a GUI a bit more compact and understandable with the condition that the person reading the code has OOP knowledge.
Yo, peace out!
|
|
|
|
|
So, from my understanding, c++ windows programming is basically MFC (or other custom libraries) whereas the C windows programming is more like the API code?
I have quite a bit to learn about the API before I can get into the MFC... I mean, I still can't figure out how to get a bitmap to show up on a button. So, yes... alot to learn.
|
|
|
|
|
SumGuy wrote:
So, from my understanding, c++ windows programming is basically MFC (or other custom libraries) whereas the C windows programming is more like the API code?
That's probably a common view these days. However before MFC, Windows developers also used plenty of libraries written in C. In many cases the libraries (C or C++) are wrappers for API functions, most of which are written in C.
A couple of time-tested standard references for Windows development are:
For API: Programming Windows, Charles Petzold
For MFC: Programming Windows with MFC, Jeff Prosise
For MFC, I also recommend:
Visual C++.NET Bible, Tom Archer (CodeProject Favorite Author)
Professional MFC VC++6, Mike Blaszczak
MFC Internals, George Shepherd
When considering Windows libraries, don't forget STL is very useful and very common in the Windows world. Also near the top of my list is ATL. With the changes (improvements) made to ATL in the .NET release, it is not just for COM builders anymore. (Not that it truly ever was!)
NONE of these books are cheap! (Esp. outside the US) But all are available in the used book market and can sometimes be found in larger public and university libraries.
marshall
If you continue to do the same things you always did, don't be surprised if you get the same results you always got.
|
|
|
|
|
Hi. I have a dailog based app and I want a popup dialog to set the text in the controls on the main dialog. How can I acomplish this without the program malfunctioning?
-- Steve
|
|
|
|
|
OK. I want to send a message from one dialog to another. How do I do that?
-- Steve
|
|
|
|
|
Pass a ptr for the main dialog to the popup dialog. Or in the popup dialog use GetParent() or something like that.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
i guess that your question is about creating a new dialog window and then change the main dialog window text from this one.
To do this create a new dialog("newdlg") then create a new class("newwin") for it setting CDialog as the base class.
Now create a class variable "x" of the type "newwin" in the definition of the main dialog window.
Add a button in the main window and edit its code as :
x.Create("newdlg",this);
x.Showwinodow(SW_sHOW);
Now you can get the status of button/edit boxes in the new popup window by
using the class member format. eg if the edit box in the popup window is "ys"
then do something ..
it could be implemented as
if(x.listboxstring = "ys)
{
do something ....
}
i hope this may help you to get started.
|
|
|
|
|
I want to postmessage my parent View when the CDialog it spawns is moved/resized. SO I put in the WM_ON_SIZING handler in the CDialog and when I debug it doesnt ever step into the OnResizing function even if I resize/move the CDialog....so I even tried putting my postmessgae in Onsize (*except I'm not changing its size, just the location....and it didnt step into OnSIze either (just moving not resizing...)
Help!
Appreciate your help,
ns
|
|
|
|
|
What messgage is sent when I move and or resize a window? What function do i Need to pinpoint he fact that I moved, dynamically?
Appreciate your help,
ns
|
|
|
|
|
And it tells me that WM_MOUSEMOVE is issued...but thats if I move the mouse anywhere on the dialog. No other message is there in the running list...
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
I want to postmessage my parent View when the CDialog it spawns is moved/resized.
Why?
To find out if a window moves try checking WM_MOVE, and/or WM_SIZE.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Why ? Because the parent remembers the location and size of the CDialog even after its dismissed and a new one is created later at the same location..also to save info to th eregistry at the end..
Thanks so much for the help!
|
|
|
|
|
|
I got my problem resolved. I'd never used WM_MOVE before. As for the OnSizing, I was expecting it to fire if I just moved, but not resized. Which was the wrong function to look at for simply moving....
Thanks. Learned a lot!
|
|
|
|
|
I need to know if I am understanding this properly:
If I want to display the time (in text) for a given number of seconds (dwSec) since Jan1, 1970 (in UTC), would I need to adjust the dwSec for the difference in time zones first before calling CTime::Format()?
Does this look right?:
DWORD dwSec = 1045688797; //Feb 19 21:06:37 2003 UTC (I think)
CTime tLoc((time_t)dwSec);
CString szLocal = tLoc.Format("%m/%d/%Y %H:%M:%S");
//Adjust for time zone diff before calling CTime::Format
//for UTC in text format:
dwSec += (tzinfo.timezone * 60);
//Adjust for DST:
if (tzinfo.dstflag)
dwSec -= 3600;
CTime tUTC((time_t)dwSec);
CString szUTC = tUTC.Format("%m/%d/%Y %H:%M:%S");
If there is a better way, I would appreciate any tips, but I still need to know if the above is correct.
Thank you very much.
|
|
|
|
|
I am wondering where I should put the On_WM_SIZING :
afx_msg void OnSize(UINT nType, int cx, int cy);
<code> afx_msg void OnSizing( UINT nSide, LPRECT lpRect);</code> here????
afx_msg void OnGetMinMaxInfo(MINMAXINFO* pMMI);
DECLARE_MESSAGE_MAP()
<code> afx_msg void OnSizing( UINT nSide, LPRECT lpRect);</code> or here????
Similarly:
BEGIN_MESSAGE_MAP(CResizeableFileDialogParentWnd, CDialog)
ON_WM_SIZE()
<code>ON_WM_SIZING()</code>
ON_WM_GETMINMAXINFO()
<code>ON_WM_SIZING()</code>
END_MESSAGE_MAP()
Appreciate your help,
ns
|
|
|
|
|
Anytime you edit the message maps manually, put your changes outside the //{{AFX //}}AFX section to avoid breaking ClassWizard.
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Thanks. I put them in the proper place now...
Appreciate your help,
ns
|
|
|
|
|
Hi,
I am beginning to write Windows applications and i have running into a few problems.
Environment: WinXP pro, Visual C++ 6.0 SP5
I currently have a dialog box with a few CEdit controls. When I try to debug my program using breakpoints or the run command (F5), the program breaks into assembly code as soon as I try to type anything into the CEdit controls. After a few 'steps' i get a message in the output pane: "First Time Exception: Integer Divide by Zero." I can push buttons though without any trouble. Using the execute (CTRL-F5) i can get to program to run fine, but obviously no debugging.
After a fair bit of swearing and searching it seems to happen when the program needs to write to a CEdit control.
A friend of mine has the same problem on windows 2000. I tried my program on my gf's computer running Win98SE and it works fine.
last bit of information, I tried running a demo from the book "Introduction to MFC" by deitel & deitel (not worth the money, btw) and it presents the same behaviour under WinXP and runs fine under Win98
Thanks a bunch
Marc
|
|
|
|
|
If your seeing Assembler instead of C++ it means that the C++ source code isn't available. When you install VC++ make sure you install the MFC and CRT source code. You can go back and install just the bits you want later on.
A "First Time Exception" exception is one that is caught, probably by a try - catch block. You should be able to see precisely why the divide by zero is occuring.
Don't fool yourself into thinking everything is fine just because it appears to run ok on some other machine or version of Windows.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Hi:
I'm a VC++ beginner and i want to write a Custom EDIT-BOX activex that work with different language (not english) for example arabic keyboard so i need to set text-alignment to right, in the other hand i want to show Text in the control in a Right-To-Left-Reading-Order programaticaly. also i need to move cursor in edit box to left not right(by default.)
How can i do this ? is there any API for this purpose? Please Help me.
please excuse me for bad comments.
|
|
|
|
|
your project requirements are inappropriate for a "VC++ beginner"
"That's just my opinion... I could be wrong."
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
Hi
A very unexpected error happened...below is the code snippet.
CMy3027View *pView;
CMainFrame *pMF = (CMainFrame*)AfxGetMainWnd();
pView = (CMy3027View*)pMF->GetActiveView();
m_numOfValues= pView->m_imageIndex;
where m_numOfValues is declared as a class member variable(integer),
m_imageIndex is a public member variable of my CView class.
1.
On debugging,pView->m_imageIndex is working fine but m_numOfValues just doesnt get assigned. It even ran into exception error.
2.
In a previous version of the same program, the same method of assignment had work fine. I have no idea why it's not working suddenly.
3.
When i try declaring m_numOfValues locally(in the function) instead, the assignment work fine.
4.Another problem is i declared
CMy3027View *pView;
in my class's header file, under private.But after assigning it in a member function, the subsequent functions do not see the assigned value.
Anyone has any idea wat's happening?
pls help..
thks
|
|
|
|
|
In relese that assigment might be optimized, so it is not surprizing you do not see it. As for the exception the code below might show you the problem
raner wrote:
pView = (CMy3027View*)pMF->GetActiveView();
if(0 == pView)
MsgBox("This is the problem");
|
|
|
|