|
missnazar wrote:
(((CButton *)GetDlgItem(IDC_CHECK_SUBFOLDER))->GetCheck() == 1);
It's never a good idea to use hard-coded values like this. Compare against BST_CHECKED instead. That's not the cause of the access violation, however.
Rather than lump all that into one convoluted statement that makes debugging rather difficult, how about breaking it up into something like:
CButton *pButton = (CButton *) GetDlgItem(IDC_CHECK_SUBFOLDER);
if (NULL != pButton)
{
if (pButton->GetCheck() == BST_CHECKED)
;
} Now you can get a better idea as to where it's failing.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
DavidCrow wrote:
Rather than lump all that into one convoluted statement that makes debugging rather difficult, how about breaking it up into something like:
Once the problem is fixed, would you put the code back to a single line? Whilst it is not as 'nice' to read I imagine it would execute quicker, not that the difference in speed will amount to much anyway. I just wondered what other people thought - more convulated, easier to read/maintain code, or 'many commands nested on one line'.
Cheers
Angel
***********************************************************
The sooner you fall behind, the longer you have to catch up
|
|
|
|
|
Angel1058 wrote:
Once the problem is fixed, would you put the code back to a single line?
I personally would not.
Angel1058 wrote:
...I imagine it would execute quicker...
True, assuming your stopwatch can measure things in nanoseconds.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello there,
I want to draw the frame around my edit controls myself.
Where should I start???
The WM_PAINT message doesn^t seem to get send untill I enter data in the control, so that`s not the way... Which message should I capture so that I can draw the frame of my edit control myself?
Thx for any help you can give.
Greetz,
Davy
|
|
|
|
|
Probably WM_NCPAINT (Non-Client paint)
If you vote me down, my score will only get lower
|
|
|
|
|
Hi!
Is there anyway of se which ethernet cards that exists on your computer? I would like to choose which one of them to use when I program a Socket with C++. For example you can have one ethernet-card that are wired and one that are wireless. How can I in Visual c++ .net choose which one to use?
Do microsoft have an class or library for this?
It would be very good if someone only have an idea of this.
/Martin
/Martin
|
|
|
|
|
why don't you take the easy way and let windows decide whats the best interface to use?
Don't try it, just do it!
|
|
|
|
|
I can´t because we are suppose to have a seamless communication between them. If you unplugs the cable for example the application shall use the wireless communication instead of the wired without loosing any data.
Is it possible to choose in any way instead of letting windows do it for you?
/Martin
|
|
|
|
|
Hi,
I need to write a little app which loads an image file (bmp, jpg or png), displays it, accesses pixel info and paints flat colour rects onto the image (- don't ask, it's a long story!).
Anyway I've done a fair bit of playing with MFC and Win32 over the past year but haven't yet touched graphics work. I intend to do a lot of graphics stuff in the future. Could anyone suggest the best approach to doing this project with a view to it giving me an intro to graphics work. Should I be concentrating on the Win32 api or GDI+ or DirectX or something else? I've no experience of GDI or DirextX at all. What are the strengths and weaknesses. All my future graphics work is likely to be 2D based.
Any advice would be much appreciated.
Many thanks,
Simon
|
|
|
|
|
If you search for CxImage on this site, you will found a nice library for working with images and image data for many graphics formats. You could do this all yourself, but why bother, since others have been down this path already.
When you say "doing graphics work," are you going to be concentrating on a GUI approach, or on a processing approach? Much of my work involves graphics processing, but there isn't much of a GUI since all the data comes from other places, is processed, and then output and manipulated in various formats without user intervention.
If your graphics work is directed toward gaming, then that is a different topic.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Hi Dave,
Thanks for the reply. I took a quick look at CxImage and did think it looked ideal. The thing that put me off is that the author implies it has now been superseded by other technologies - I didn't want to spend time getting to grips with something then to realise I have to get to know GDI+ or DirectX.
I know DirectX is heavily used for games. A few of the projects I'm interested in looking at include playing back image sequences using RAM buffers, and importing, scaling, compositing and displaying image files in an application environment. As these are pretty performance driven I wondered if DirectX's 2D capabilities may be desirable.
I also heard there's a new display technology available through Longhorn, and would rather spend time learning something that will be around for a while.
Anyhow, your suggestion of using CxImage has confirmed my feeling that it is probably a good place to start so I'll check it out again.
Cheers Dave,
Simon
|
|
|
|
|
You know, it really is as if you had a nail. All you want to do is pound the nail into something, so you think about looking at hammers. There are wooden handled hammers and graphite handled hammers. There are framing hammers and finish hammers. Depending on exactly what you want, any of them could do the job. Which is better? Well, it depends.
CxImage is primarily MFC/Win32 based. I've used it without needing GDI+ or DirectX. I've looked into OpenGL too, but that didn't really fit my needs. I may use OpenGL later for something different, but I didn't need it now. They all have strengths and weaknesses, just like hammers, for specific tasks. I know that's what you're asking about.
Which one should you focus on? That's hard to say. Any of them can do the job, but they will do it in different ways. Make this series of function calls versus that series of function calls. Do you just want to get started with something? Or, are you concerned about ultimate performance, cross-platform compatibility, ease of programming, future of technology support, etc?
At this stage, I think it's just better to pick something and go with it. Which one probably won't make much difference right now.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Hello !
I need to design a Wizard to configure my programs (via configuration files). I want to know if it's possible, with a CPropertySheet in Wizard mode, to do thinks like that:
1) At first, add just 1 or two pages in the wizard. These pages will be used to select wich applications must be installed and things like that.
2) With the user choice made in step 1, in need to add pages to the wizard (1 page to configure each application -> so the number depends of how many app have been chosen in step 1 )
3) On each page, when the user click Next, I need to get the data he has selected. So here, what I need, is override the 'next' handler, get the page index and get all the data on the propertyPage to store them somewhere
4) When the user select Back, I need to show the previous Page with the previous data (so not default data but the data he had chosen before...)
So I want to know if all these things are easily possible using a PropertySheet ? And if possible, point me in some directions
|
|
|
|
|
Are you using MFC?
If so, all of this is easy to do...
1. Add initial pages - CPropertySheet AddPage
2. Yes, again, use CPropertySheet AddPage. You can also remove pages with CPropertySheet RemovePage
3. Process data in CPropertyPage OnKillActive or else CPropertyPage UpdateData (Data Exchange Handlers). As for storing, make a separate singleton data container class to hold all the information for the program, access it via a gobal accessor function.
4. Same as 3, except you might be interested in the CPropertyPage OnSetActive.
|
|
|
|
|
Hello,
I have a problem, this is the following.
I make a a form. There is a button on the form.
The form have a event execute ShowInTaskBar is false.
The Button have 3 event, 1st event is MouseLeave event, this is BackColor of it is black, 2nd event is MouseEnter event, this is BackColor of it is white, 3rd event is ButtonClick event, this is ShowInTaskBar is true.
Before I click a button, mouse event is enable. but after I do it, mouse event is disable. This condition is a button's backcolor is white, not change black yet.
private void button1_MouseLeave(object sender, System.EventArgs e)
{
button1.BackColor=Color.Black;
}
private void button1_MouseEnter(object sender, System.EventArgs e)
{
button1.BackColor=Color.White;
}
private void Form1_Load(object sender, System.EventArgs e)
{
this.ShowInTaskbar=false;
}
private void button1_Click(object sender, System.EventArgs e)
{
this.ShowInTaskbar=true;
}
I think this is bug of .NET. But I resolve this problem. If you have some solutions, please tell me.
Cheers,
yu-yu
|
|
|
|
|
Hi there !
Im stuck with my win32 application where I want to add an bitmap to a control button in a dialog.,
Im tryin to use the BM_SETIMAGE message but I dont get it to work... I have a bitmap IDB_BACKWARD_BITMAP defined in the resource.rc and given an id in resource.h
The control button IDC_BUTTON1 that I want to attach the image to is defined in the resource.rc
here is my callback function for the dialog window that also contains an combobox etc but its not displayed here.
LRESULT CALLBACK ToolboxProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
LRESULT iComboBoxSelection;
switch(Msg)
{
case WM_INITDIALOG:
SendMessage(GetDlgItem(hWndDlg,IDC_BUTTON1), BM_GETIMAGE, IMAGE_BITMAP, IDB_BACKWARD_BITMAP);
..............
I have also tried a version where I load the bitmap like this;
Bitmap=LoadBitmap(t_hInst,MAKEINTRESOURCE(IDC_BUTT
ON1));
SendMessage(GetDlgItem(hWndDlg,IDC_BUTTON1), BM_GETIMAGE, IMAGE_BITMAP, Bitmap);
Where I have defined HINSTACE t_hInst global but is there anything else that I have to do with it? and i also get an error
"cannot convert parameter 4 from 'BITMAP' to 'LPARAM'
......
Any help would be grateful because I dont have any clue about what to do
Regrads
/Peter
|
|
|
|
|
|
I want to use wave file in my project.
When i click button,some music is appear.
|
|
|
|
|
Occam once said..
PlaySound - The PlaySound function plays a sound specified by the given filename, resource, or system event. (A system event may be associated with a sound in the registry or in the WIN.INI file.)
|
|
|
|
|
How about sndPlaySound() ?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello,
I have open a modless dialog winodws and I need to close the window. Is I do that i works but if I try to open the dialog again it fails.
So how can I open and close a modless dialog and it works?
I have a dialog and from that dialog I need to bring up a modless dialog and close so it needs to be open and close.
This is how I have done!
Main dialog.
m_modless.create(IDD_MODLESS);
m_modless.SHowWindow(SW_SHOW);
.... And the modless dialog is shown.
from the modless dialog I try to use
OnOK(); // To close the dialog and it works but I can NOT open the modless dialog again.
And I have try to use,
CModless m_mod;
m_mod.CloseWindow(); // and this do NOT work at al.
Please help me someone.
|
|
|
|
|
The dialog you create is not the dialog you close.
So it don`t work as you want.
|
|
|
|
|
No it don't how can I fix this?
I need to close the dialog so I can open the dialog again.
Can you help me please?
|
|
|
|
|
If the window is going to be opened and closed lots of times, then it'd make sense to not close the window at all, but just hide it away
i.e.
m_modless.ShowWindow(SW_HIDE); to hide it, then m_modless.ShowWindow(SW_SHOW); to make it re-appear
(remember not to try and re-create the window when you re-show it, you only need to do that the first time you use the window)
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
|