|
You can find a Win32 pthreads library at http://sources.redhat.com/pthreads-win32/
|
|
|
|
|
The problem is that the dialog has not been created yet so you can't set its text, and SetWindowText isn't a member function of the CColorDialog class. It should be something like this:
CColorDialog clrDlg;
clrDlg.m_SomeMemberVariable.NameVariable = "Select Object Color";
clrDlg.DoModal();
-Raffi
|
|
|
|
|
Well, this is a rather common misundertanding about MFC dialogs and the underlying windows. When you construct a CColorDialog (or some other type of dialog, for that matter), it is only the MFC wrapper that gets created. It is in the middle of DoModal that the underlying HWND is actually created and attached to the MFC object. Unfortunately, after calling DoModal is all too late for setting the caption (the dialog has already exited.) The way out of this dilemma is as follows:- Create a class derived from
CColorDialog , say CMyColorDialog .
- Provide a constructor accepting the caption that stores it in some member variable defined to that purpose, say
m_caption .
- Add an
OnInitDialog handler and set there the new caption with SetWindowText(m_caption) .
Good luck!
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I want to save some information in SYSTEM REGISTRY and then retrieve.
any one?
|
|
|
|
|
Why don't you use one of the classes available here at CP ?
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
More about me
|
|
|
|
|
You can use a registry class as Colin Davies suggested but if you want to directly use API, look up the following functions on MSDN
RegOpenKeyEx
RegCloseKey
RegEnumKeyEx
RegCreateKeyEx
RegDeleteKey
RegQueryValueEx
and
RegSetValueEx
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
How about the Old style WriteProfileString, WriteProfileInt and to retrieve use the GetProfileInt and GetProfileString. It works for me and it will work for you too. Make sure that in the App's InitInstance change the SetRegistryKey function if you don't want the stuffs to get saved in the "Local AppWizard.. Bla bla".
Sudip
Its QTime
|
|
|
|
|
Hi: I am trying to create a window using Microsoft, Visual C++ with MFC. I created the window with an “edit” box that is supposed to receive input from the keyboard. I also created a variable under the “edit” box IDC_BUTTON1 so that when I input data to the “edit” box, it can be transferred into the variable associated with the IDC_BUTTON1 and used in a C++ program. However, when I execute the program, nothing gets into the variable created. I am not sure of how I input data and transfer it to my C++ program. Any help will be appreciated.;P
|
|
|
|
|
in the handler for the button, call UpdateData(TRUE); this will load the data from the dialog into your variables, via the DDX calls that the class wizard has generated for you.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Thanks for your help Joaquín M López Muñoz. I have got the grid into the print dc. just have to resize
Desmond Mardle
|
|
|
|
|
I have been writing an application for an amatuer radio logbook. The application writes the entries into a grid which is displayed on the screen.
This works well the data is stored in an array and the grid is an Active X control. I am trying to write a print function for the app. The problem I have is transfering the grid to the on print routine. Can anyone tell me how to transfer the grid object to the OnPrint device context for printing.
Any help would be appreciated
Desmond Mardle
Des Mardle
|
|
|
|
|
I'm not sure whether this will work, but it might be worth giving a try: In your OnPrint handler, send a message WM_PAINT to the ActiveX control passing as argument the DC you were provided:
void OnPrint(CDC* pDC,CPrintInfo* pInfo)
{
m_grid.SendMessage(WM_PAINT,(WPARAM)(pDC->m_hDC));
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Well for the first query:
1) What you have done is right but in the wrong place. You probably have done it in App's InitInstance and after the DoModal() call. The correct place to do it is in the WM_SHOWWINDOW handler in the dialog class.. Just Override WM_SHOWWINDOW and type in ShowWindow(SW_MAXIMIZE).. its gonna work. You can also do it in the InitDialog handler.
2) Override the Oncalcel function in your derived Class. Make sure u don't call CDialog::OnCancel() in it.
Thats it
Sudip
|
|
|
|
|
When creating regions in GDI+ what is returned? Creating a region in the usual GDI returns a HRGN but what is returned in GDI+? A pointer? If so can I use that pointer stored in a struct for later use?
|
|
|
|
|
You get Region class instance which is wrapper for HRGN and works like MFC CRgn. You can work with it as with instance of any other class.
|
|
|
|
|
What is the diff. between GDI and GDI+?
|
|
|
|
|
GDI is the base graphical system that comes with Windows XP/2K/NT/ME etc.
If supports base drawing primatives and has limited image support.
GDI+ is shipped as a DLL which you can use in your application for 2K/NT/ME this must be shipped with your app. (~1.6mb). What you give is rich support for images, gradient brushes, text etc. etc. The programming model also simplifies the use of GDI:
EXAMPLE:
WCHAR string[] =
L"Draw text in a rectangle by passing a RectF to the DrawString method.";
FontFamily fontFamily(L"Arial");
Font font(&fontFamily, 12, FontStyleBold, UnitPoint);
RectF rectF(30.0f, 10.0f, 100.0f, 122.0f);
SolidBrush solidBrush(Color(255, 0, 0, 255));
graphics.DrawString(string, -1, &font, rectF, NULL, &solidBrush);
Pen pen(Color(255, 0, 0, 0));
graphics.DrawRectangle(&pen, rectF);
...
GDI+ is supported by .NET by default.
Normski. - Professional Windows Programmer
|
|
|
|
|
Thank you verymuch for your detailed response.
|
|
|
|
|
I like the GDI+ compared to GDI just for the image support alone. I still find it confusing since to me it seems you have to convert some things to GDI+. For example Rect to Crect when you use GetClientRect() or creating a bmp with CreateCompatibleBitmap() then using the HBITMAP handle for GDI+ Bitmap::FromHBITMAP(). Or am I missing something?
Other than that I love the new bush and image classes.
|
|
|
|
|
It's actually making sense to me now. The graphics object is associated with a dc then you can use that graphics object to draw, paint or what ever you can dream of. You can even have multiple graphics objects associated with a dc and each one is independent which I think is pretty cool.
I was trying to use multiple dc's associated with multiple graphics objects and wondering why each object I had was independent. LOL
It's just one big wrapper for GDI. Looks like MS is trying to integrate GDI+ more closely to DirectX.
|
|
|
|
|
Jay
If this makes you feel any better, I wrote my 2nd windows app. a tile puzzle game similar to the apple one. I tried to use a DC for each tile... No No No. any way a good way of learning Win32/GDI I still have the source code 'circa 93 maybe a good time to revamp and submit as a codeproject app.
Normski. - Professional Windows Programmer
|
|
|
|
|
I keep maintaining a 2D chat client/server app and every time I set out to learn something new or better I apply it to my app. It was my first windows app that I attempted. My wife likes these 2D chats and their kinda of fun. I told her I could program one better. Three years later and I'm still making it better. LOL
I was a big windows hater in the beginning and was determined to stay Unix/Linux or Dos based - that quickly changed when I seen the bigger paycheck. So everything for a reason. Since going for the windows based work I'd have to say I'v learned more than ever from the experience. It would be cool to see how you did your game - That is if you really want to give it up.
I might do another app for codeproject dealing with unlimited dynamic menu sub items for a bookmark idea I did. Sort of like IE explorer. I never seen decent examples of that. Anyways I'm rambling on.
Cheers Norm
|
|
|
|
|
I would like to use the CFileDialog class to allow a user to navigate-to and specify a directory. My program will write a file to this directory at a future time, in other words it is not a simple 'immediately save a file' situation.
How can this be done?
I've used CFileDialog quite a bit for finding 'files' and saving 'files' but not finding a directory.
TIA !
|
|
|
|
|
|
Thanks Mike.... almost got it working
I'm a bit confused on the pidlroot, ITEMIDLIST for specifying the starting directory.
How exactly do I put a null string or a class string with the start path into this function?
TIA
|
|
|
|