|
Oops!
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi,
It seems that I have problem drawing ownerdrawfixed combo box, which is actually drawn in ownerdraw listbox control.
I am able to draw all items inside shown dropdown of combo box. But I can not draw anything to combo box "header".
1. What is actual message of drawing combobox "header" ? I got to conclusion that when itemID is -1 (after I call CB_SELECTSTRING) then it is "header" (Note: Seems that right rect is found in DRAWITEMSTRUCT) and I draw text than but nothing appears.
2. Currently I am trying to draw it after CB_SHOWDROPDOWN is set to true. Should it be done before that?
|
|
|
|
|
I'm guessing, handle the WM_DRAWITEM message in the parent window, then check the CtlID
member of DRAWITEMSTRUCT to see it's the correct combobox control, if so check the itemState member to see if it is ODS_COMBOBOXEDIT, and if so, draw the edit box (I think the edit box is what you mean when you say "header")control of the combobox.
Hope it helps.
|
|
|
|
|
Hi,
I have one question regarding resolution. How to make a project created as a MFC dialog based application, resolution independent. I am using a number of images in our dialog based project. But the final display using images and controls is not resolution independent. To say if your PC screen resolution is different from the other, it will not properly display the dialog. Some of the part of dialog display will be cut-off.
How to make the same resolution independent, so that irrespective of the resolution of the device or screen size, display should be same.
Any help will be appreciated.
Also, what is the use of ActiveX controls in MFC.?
Regards,
Mbatra
|
|
|
|
|
I assume that your dialog is created using a resource template.
The simple solution is to limit the size of the dialog to the minimum size of supported screen resolutions.
If your application must also run on small screens, you may add a second dialog template with smaller controls and smaller total size. Upon program start, choose the small template when necessary.
The complex solution would be making your dialog and some or all controls resizable. But this requires proper calculation for sizes and positions of all controls.
Regarding ActiveX
There is no need to use ActiveX controls if your application design can be done using the standard Windows and MFC controls. If you have special control requirements, you can build your own controls by using ActiveX or plain C++ code, or use existing controls that fit your requirements. Finally, it's up to you to decide to use ActiveX controls or not.
|
|
|
|
|
Hi,
Thanx for your reply.
It is not that my project will run on smaller screeens only. It may run on larger screens also.
Let me explain, I have windows 7 & my PC screen is of bigger size (vertically as well as horizantally) (bigger than a normal LCD display). if I run my project on my PC, I am not able to see the controls on the bottom of the dialog. if I run my project on any PC with windows XP and screen size is small, it will display it perfectly.
I want to make it like that all the controls should adjust them accordingly irrespective of the resolution or PC screen size.
Any help will be appreciated.
Regards,
Mbatra
|
|
|
|
|
I'm confused now.
The display is OK on small screens but the bottom controls aren't visible on a big screen?
At least you should tell us about your dialog. Is it a template based CDialog or a CDHtmlDialog ?
|
|
|
|
|
Hi,
its a template based CDialog.
Regards,
Mbatra
|
|
|
|
|
But then I don't understand why portions are not visible on a big screen. Because with a template based CDialog the size of the dialog and sizes and positions of all controls are defined in the template. As long as nothing is changed by code, the dialog should be shown like in the resource editor. If the screen is larger than the dialog, your app should be opened with centered dialog. If the screen is too small, the right and/or bottom sides are clipped.
|
|
|
|
|
Hi,
Sorry for any confusion.
What I understand is, we are using images for all the controls, whether its a button, static control, slider control etc..... So i thought the image size will never change irrespective of the resolution or the size of the screen. Because image size will remain the same.
its a dialog based app, I also want to understand what makes it that when I open it on screens with different sizes, some controls at the bottom are not visible.
Regards,
Mbatra
|
|
|
|
|
Even with images the sizes of the controls are usually not resolution dependant because this would require repositioning inside the dialog to avoid overlapping.
It seems that you are using non standard controls but custom ones. So you should have a look into the sources and/or the documentation of these custom controls to know what happens. You may also use the debugger to check if missing controls are created or not and get the sizes and positions of these controls (e.g. by calling GetWindowRect() and printing the values to the debug output window using TRACE ).
|
|
|
|
|
Design all your dialogs for the smallest resolution.
Then when your application runs, check the resolution and see how much extra space you have in the X and Y directions.
Divide this extra space among the controls in your dialog. The extra space shouldn't be divided equally -- Some controls benefit more from extra space than others. For example, a Static or Edit control wouldn't be helped by more Y-direction space, but a List Box would be able to show more items.
Likewise, some space between controls will appear better when extended than other space.
For each dialog, you can list the percentage of extra space you want to add to each control.
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
|
|
Wow, what an interesting post.
Veni, vidi, vici.
|
|
|
|
|
in Flight.h i have this prototype :
bool reserveSeat(Passenger psngr, bool smoker);
and i have to do the implementation for it , i try to do it but i got an error :
"
error message :
task b\flight.cpp(15): error C2228: left of '.setPassportNumber' must have class/struct/union
1>type is ''unknown-type''
1> b\flight.cpp(16): error C2065: 'passenger' : undeclared identifier
1>b\flight.cpp(16): error C2228: left of '.setContactNumber' must have class/struct/union
1>type is ''unknown-type''
1> b\flight.cpp(17): error C2228: left of '.smokerSeat' must have class/struct/union
and here is my try
bool Flight::reserveSeat(Passenger psngr, bool smoker)
{
Passenger.setPassengerName(psngr.getPassengerName());
passenger.setPassportNumber(psngr.getPassportNumber());
passenger.setContactNumber(psngr.getContactNumber());
reservations.smokerSeat=smoker;
}
note that Flight have an object of Reservation and here's the Reservation constuctor :
Reservation.cpp
Reservation::Reservation(Passenger& psngr, bool smoke)
{
passenger.setPassengerName(psngr.getPassengerName());
passenger.setPassportNumber(psngr.getPassportNumber());
passenger.setContactNumber(psngr.getContactNumber());
smokerSeat=smoke;
}
and here's the whole Flight Header
#include "reservation.h"
#include "okReservation.h"
#include "waitReservation.h"
class Flight{
private:
int waitingListMax;
int seats;
int seatsCount;
Reservation** reservations;
public:
Flight(int capacity, int waitingMax);
bool reserveSeat(Passenger psngr, bool smoker);
void cancelReservation(string resNum);
okReservation confirmReservation(waitReservation* res);
void printWaitingList();
void printReservationList();
};
|
|
|
|
|
alaaan73 wrote: Passenger.setPassengerName(psngr.getPassengerName());
passenger.setPassportNumber(psngr.getPassportNumber());
as far as i can tell, you have not declared any variables named "Passenger" or "passenger".
reservations.smokerSeat=smoker;
you have declared reservations as a pointer to a pointer to a Reservation.
Reservation** reservations;
so you can't use "reservations.smokerSeat". you would have to declare it as:
Reservation reservations;
etc..
|
|
|
|
|
You have:
bool Flight::reserveSeat(Passenger psngr, bool smoker)
{
Passenger.setPassengerName(psngr.getPassengerName());
passenger.setPassportNumber(psngr.getPassportNumber());
passenger.setContactNumber(psngr.getContactNumber());
reservations.smokerSeat=smoker;
}
which makes little sense. you are using both Passenger (with upper case P), and passenger (with lower case p) to refer to something. But what, why would you try to set the value of an item in an object from the value taken from that object? Similarly the statement
reservations.smokerSeat=smoker;
make little sense as reservations is a pointer to a pointer (of something). I think you are a little confused about your classes and how they connect to each other.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
You can call a class method either by using the '. ' operator on an instance of that class, e. g.
psngr.SetPassengerName("SomeName");
Or by using the '::' operator on the class, if it is a static method, e. g.:
Passenger::SetPassengerName("SomeName");
I don't think either makes sense in this case however.
Your mistakes have already been pointed out, but from the information you gave us it's hard to derive what is actually needed to fix them. Looking at the declaration of class Flight , I suspect that reservations is supposed to be a list of, well, reservations. The prototype of cancelReservation(string resNum) indicates that you are supposed to use a string representing the reservation number as a key for retrieving a specific reservation. So your reservations may in fact be organized as a sorted tree - but that is something you have to find out for yourself.
In any case, the method reserveSeat() should create a new object of type Reservation and add it to that list. Probably you should apply these method calls on that new object in order to properly initialize it. The declaration of class Reservation should shed more light on this.
|
|
|
|
|
Hi,
I have used DirectShow to capture a video stream in C++/MFC. Now I want to increase the quality of the captured video, I want to capture HD video using DirectsShow/DirectX.
Is it possible to capture HD video using DirectX/DirectShow in C++/MFC/VC++.?
Any help will be appreciated.
Thanx in Advance.
Regards,
Mbatra
|
|
|
|
|
Have you done it? Please help me
|
|
|
|
|
|
In InitInstace after OnFileNew() called, its was found m_phWnd is null. OnFileNew() is default implementation of mfc.
Please help me out.
|
|
|
|
|
You should provide more information to get help. Use the 'Edit' link below your post to do this (e.g. add a short code snippet).
What is the class for m_phWnd (there is no CWinApp member with this name?
|
|
|
|
|
Actually I had wrongly mention the member name, it is m_pMainWnd.
I am sorry, I cannot provide the code snippet.
|
|
|
|