|
But the result is wrong and to refer to MSDN:
it's only for TrackMouseEvent and that don't support Windows95
I will try do it further.
|
|
|
|
|
In my application,I have to get the field's information(name,type,length...),later I call the SQL sentence "Create table ....." to create my table ,so I want to get source code for collectting the inforations of fields (or columns),just as sql server table design.thanks!!!
|
|
|
|
|
please help me!
|
|
|
|
|
Try the SQL forum. This is the Visual C++ forum.
|
|
|
|
|
I'm trying to draw an edit control so you can see the background, so I'm drawing it transparently, drawing the background I want and invalidating it whenever it seems necessary. I've tried returning a null brush and returning a pattern brush from WM_CTLCOLOR. It all works great, until I use the arrow keys. If I type over the text that is being edited, the old text remains in place, although my invalidate call is working. I have found samples that work on the web, and I don't see how my code is different, does anyone have any clue ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
As always, asking the question helps me find the answer. It's all working great now.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
OK, you piqued my interest. How did you get it to work? Inquiring minds want to know (well I want to know anyway).
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
G'day, PJ
OK, in the first instance, the samples I found just passed back a transparent brush and set transparent mode in WM_CTLCOLOR ( as you also suggested ), and then called an Invalidate on the area in the parent when the mouse was clicked, or text is updated ( EN_UPDATE, from memory ). This worked in the samples, but not for me. I initially draw my background in WM_PAINT, but moved it to WM_ERASEBKGND, and the overall effect was great, excepting that if I used the arrows, or tried to select, no text was ever erased, it just went over itself.
So, I changed the code to use WM_PAINT again ( I tried going back and it doesn't work ), and I basically just draw my background, then draw the text over the top. I also need to figure out the selected area, and redraw that with a solid background, and now it all looks great.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I am doing a project in win32. When I start the app, I want to find out the details of all the monitors that are connected to the system. ie. the windows monitor number, if it a usb or serial monitor, etc...
I am doing the following...
<br />
hDevInfo = SetupDiGetClassDevs(NULL,<br />
REGSTR_VAL_DISPLAY,
0,<br />
DIGCF_PRESENT | DIGCF_ALLCLASSES );<br />
<br />
DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);<br />
for (i=0;SetupDiEnumDeviceInfo(hDevInfo,i,<br />
&DeviceInfoData);i++)<br />
{<br />
DWORD DataT = REG_SZ;<br />
LPTSTR buffer = NULL;<br />
DWORD buffersize = 0;<br />
while (!SetupDiGetDeviceRegistryProperty(<br />
hDevInfo,<br />
&DeviceInfoData,<br />
SPDRP_LOCATION_INFORMATION ,
&DataT,<br />
(PBYTE)buffer,<br />
buffersize,<br />
&buffersize))<br />
.........<br />
but how can I find out the windows monitor number, and some other details like serial/usb of model number etc...
|
|
|
|
|
Hallo
newbee confused
Ok i have a class car.h and a class carpark.h looking like this:
<br />
#include "car.h"
<br />
class carpark <br />
{<br />
public:<br />
carpark(int size);<br />
~carpark();<br />
<br />
void insert(car *p1);<br />
<br />
class Iterator;<br />
friend class Iterator;<br />
<br />
private:<br />
car** array;<br />
};<br />
<br />
class carpark::Iterator<br />
{<br />
public:<br />
Iterator(carpark &cp);<br />
~Iterator();<br />
<br />
void reset();<br />
void next();<br />
car* get();<br />
carpark &c;<br />
<br />
};<br />
Now how to implement Iterator ???
<br />
carpark::Iterator::Iterator(carpark &cp)<br />
{<br />
c = cp;<br />
}<br />
this throws some error i dont understand
"'c' : must be initialized in constructor base/member initializer list"
and while using the defaultconstructor
i can't access the functions from Iterator
<br />
int main()<br />
{<br />
...<br />
carpark::Iterator it();<br />
it.reset();
...<br />
}<br />
What to do - or where to read about something like this
Please Help
THX alot
|
|
|
|
|
Hello,
A constructor initializers list is a special place for initializing member variables of a class. The following example solves your problem:
class carpark::Iterator(carpark& cp)
: c(cp)
{
}
I assume that you know how to implement the iterator, but here's one little tip for the road: your next() function should return a bool . This makes it more easy to iterate through your carpark:
carpark cp;
carpark::Iterator iter(cp);
if( )
{
while( iter.next() )
{
}
}
Hope this helps
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
THX
Thats it...
Well knowing how to use the iterator ..
no ...
but i'll learn it now ..
Hope so
THX
|
|
|
|
|
tbrake wrote: THX
Thats it...
You're welcome!
tbrake wrote: Well knowing how to use the iterator ..
no ...
but i'll learn it now ..
Feel free to ask when you get stuck!
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Actually I hooked it with the purpose of hiding a file. But as far as I could see the explorer makes a lot of calls for FindNextFile and it eventually crashes.
How can I hide the file though or how can I fix this pb.
I get the same pb when I hook CreateFile the explorer craseh immediatelly.
gabby
|
|
|
|
|
|
Have you ever heard of privacy ?
what if I want a folder to be private?
and what is with the atitude dude ?
I posted a question .
If u know the answer and u are willing to help answer me otherwise I don't need your stupid replies
gabby
|
|
|
|
|
euacela wrote: what if I want a folder to be private?
Windows has user-level permissions built in.
euacela wrote: otherwise I don't need your stupid replies
on no
of course you don't have to tell us the name of your app. but i thought it might be nice if you could warn us so that we could know in advance which programs are out to subvert our filesystems.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
euacela wrote: Have you ever heard of privacy ?
what if I want a folder to be private?
there is much differnce between Privacy and making folder private.. what if you make spy ware application that hide users important file...
euacela wrote: what is with the atitude dude ?
if I ask same about yours....
euacela wrote: If u know the answer and u are willing to help answer me otherwise I don't need your stupid replies
Hai.. are we your servent ?... calm down.. behave professionally, you are not a kid. if you don't like the comment better not answer his/her reply..
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hey man what is this a programming forum or a good manner forum.
And look at this Chris Losinger guy, the question wasn't addressed to him and it is not about servents. I said if you are willing to help ! Do you kn ow what that means ? As I can see no. Willing means if you want and no one is forcing you. I didn't say you must help me (like others post questions and get answers).
Isn't this a Visual C++ forum. Am I on the wrong website asking how to better hook FindNextFileW ?
If you think you can help and if you want to help I would appreciate that otherwise don't reply comment regarding the "IQ" of my question. For you smart guys it is very easy right? Well I am not like that. I don't need opinios wheter the program is good or bad the program is for me. I am not a hacker or whatever you might think. I am registered on this website for a while and it used to be better much better. Everybody would encourage you to ask whatever to develop your c++ skills, now everyone is treating you like a scum (and you call it evolution )
Now there are only wise guys that come around with opinions
Thank you.
gabby
|
|
|
|
|
euacela wrote: Hey man what is this a programming forum or a good manner forum.
Good Manner are also part of Good programming...
euacela wrote: Chris Losinger guy
Have you check the Age difference between you and Mr. Losinger? Do you treat elderly people same way at your home?
euacela wrote: I am not a hacker or whatever you might think.
I very Well Know that.. I have appreciated article written by you many times, if you doesn’t remember that.. You can still check that at the forum situated at bottom of your article...
euacela wrote: For you smart guys it is very easy ri
Who say I am Smart Guy?!... I am simple Programmer like you.. Frankly speaking... you have much more knowledge of language than me...
euacela wrote: Now there are only wise guys that come around with opinions
I believe, your are taking suggestion wrong way.. Calm buddy.. Before it too late.. I have done many mistake due to this... but ... leave it .... Your wish.. Who am I who are advising you... you are well grown up guy.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
ThatsAlok wrote: euacela wrote:
Hey man what is this a programming forum or a good manner forum.
Good Manner are also part of Good programming...
I agree to that. I don't know who you are Mr Losinger's lawyer . . .
But look at how this thing started I just asked a question and you started making fun of me. Is that good manner I don't but id this is how you do around here I have no need for this website
gabby
|
|
|
|
|
euacela wrote: this is how you do around here I have no need for this website
Ok Ok calm Down... I am sorry.. you are right I am not Chris lawyer nor admin here neither I am making fun of you... ..
But remember one thing for this ego you going to pay in future...
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I am new to windows programming, and am using Visual Studio .Net 2003.
I have a standard managed form which contains a number of data entry fields (textboxes, radio buttons etc), and a couple of buttons.
One of the buttons (labelled Save) activates an event handler that calls two functions. The first function will perform some validation on the data entered in the form, and then displays a message on a second smaller form with an OK button. This OK button closes the form. The second function then formats some of the data, and will eventually write it to a file.
How do I stop the second function running until after the OK button on the form displayed by the first function is clicked ? Or, in other words, how do I stop the 2nd function from running until the first is complete.
The program so far is listed below, and the event handler concerned is called collegeForm::buttonSave.
Many thanks
#using <mscorlib.dll>
#using <system.dll>
#using <system.drawing.dll>
#using <system.windows.forms.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
__gc class collegeForm : public Form
{
public :
collegeForm();
private :
Label *labelSurname;
Label *labelForename;
Label *labelGender;
Label *labelDateOfBirth;
Label *labelAccomodation;
Label *labelSupportCode;
Label *labelCourseCode;
TextBox *surname;
TextBox *forename;
TextBox *courseCode;
TextBox *dateOfBirth;
ComboBox *supportCode;
GroupBox *gender;
RadioButton *male;
RadioButton *female;
GroupBox *accomodation;
RadioButton *parentalHome;
RadioButton *lodgings;
RadioButton *hallsOfResidence;
Button *save;
Button *clear;
MainMenu * mainMenu;
void buttonSave(Object *Sender, EventArgs *Args);
void buttonClear(Object *Sender, EventArgs *Args);
Int32 validateForm(void);
void formatNames(void);
};
__gc class errorMessage : public Form
{
public :
errorMessage();
errorMessage(String *);
private :
Label *message;
Button *ok;
void buttonOK(Object *Sender, EventArgs *Args);
};
errorMessage::errorMessage()
{
}
errorMessage::errorMessage(String * errorMessage)
{
this->Text = S"Error Message";
message = new Label;
message->Text = errorMessage;
message->Location = Point(25,100);
this->Controls->Add(message);
ok = new Button;
ok->Location = Point(180,120);
ok->Text = "OK";
ok->Click += new EventHandler(this,buttonOK);
this->Controls->Add(ok);
}
void errorMessage::buttonOK(Object *Sender, EventArgs *Args)
{
Close();
}
collegeForm::collegeForm()
{
this->Text = S"College Enrollment Database";
labelSurname = new Label;
labelSurname->Text = S"Surname";
labelSurname->Location = Point(25,100);
this->Controls->Add(labelSurname);
labelForename = new Label;
labelForename->Text = S"Forename";
labelForename->Location = Point(25,150);
this->Controls->Add(labelForename);
labelGender = new Label;
labelGender->Text = S"Gender";
labelGender->Location = Point(25,200);
this->Controls->Add(labelGender);
labelDateOfBirth = new Label;
labelDateOfBirth->Text = S"Date Of Birth";
labelDateOfBirth->Location = Point(25,250);
this->Controls->Add(labelDateOfBirth);
labelAccomodation = new Label;
labelAccomodation->Text = S"Accomodation";
labelAccomodation->Location = Point(25,300);
this->Controls->Add(labelAccomodation);
labelSupportCode = new Label;
labelSupportCode->Text = S"Support Code";
labelSupportCode->Location = Point(25,350);
this->Controls->Add(labelSupportCode);
labelCourseCode = new Label;
labelCourseCode->Text = S"Course Code";
labelCourseCode->Location = Point(25,400);
this->Controls->Add(labelCourseCode);
surname = new TextBox;
surname->Location = Point(125,100);
surname->Width = 200;
this->Controls->Add(surname);
forename = new TextBox;
forename->Location = Point(125,150);
forename->Width = 200;
this->Controls->Add(forename);
courseCode = new TextBox;
courseCode->Location = Point(125,400);
courseCode->Width = 100;
this->Controls->Add(courseCode);
dateOfBirth = new TextBox;
dateOfBirth->Location = Point(125,250);
dateOfBirth->Width = 200;
this->Controls->Add(dateOfBirth);
supportCode = new ComboBox;
supportCode->Location = Point(125,350);
supportCode->Width = 230;
supportCode->Items->Add(S"No Known Disability");
supportCode->Items->Add(S"Dyslexia");
supportCode->Items->Add(S"Blind or Partially Sighted");
supportCode->Items->Add(S"Deaf or Impaired Hearing");
supportCode->Items->Add(S"Mobility Difficulties or Wheelchair User");
supportCode->Items->Add(S"Personal Care Support Required");
supportCode->Items->Add(S"Mental Health Difficulties");
supportCode->Items->Add(S"Unseen Disability - Diabetes, Asthma");
supportCode->Items->Add(S"Two Or More Of The Above");
supportCode->Items->Add(S"Other Disability Not Listed");
supportCode->Text = S"No Known Disability";
this->Controls->Add(supportCode);
gender = new GroupBox;
gender->Location = Point(125,175);
gender->Size = Drawing::Size(300,55);
Controls->Add(gender);
male = new RadioButton;
male->Location = Point(25,20); // These are coords in group box
male->Text = S"Male";
gender->Controls->Add(male);
female = new RadioButton;
female->Location = Point(150,20);
female->Text = S"Female";
gender->Controls->Add(female);
accomodation = new GroupBox;
accomodation->Location = Point(125,275);
accomodation->Size = Drawing::Size(450,55);
Controls->Add(accomodation);
parentalHome = new RadioButton;
parentalHome->Location = Point(25,20);
parentalHome->Text = S"&Parental Home";
accomodation->Controls->Add(parentalHome);
lodgings = new RadioButton;
lodgings->Location = Point(150,20);
lodgings->Text = S"Lodgings";
accomodation->Controls->Add(lodgings);
hallsOfResidence = new RadioButton;
hallsOfResidence->Location = Point(275,20);
hallsOfResidence->Text = S"&Halls Of Residence";
accomodation->Controls->Add(hallsOfResidence);
save = new Button;
save->Location = Point(175,500);
save->Text = S"&Save";
save->Click += new EventHandler(this,buttonSave);
this->Controls->Add(save);
clear = new Button;
clear->Location = Point(350,500);
clear->Text = S"&Clear";
clear->Click += new EventHandler(this,buttonClear);
this->Controls->Add(clear);
mainMenu = new MainMenu();
MenuItem *menuFile = mainMenu->MenuItems->Add("&File");
menuFile->MenuItems->Add("&Validate");
menuFile->MenuItems->Add("&Save");
menuFile->MenuItems->Add("&Clear");
menuFile->MenuItems->Add("-");
menuFile->MenuItems->Add("&Exit");
MenuItem *menuHelp = mainMenu->MenuItems->Add("&Help");
menuHelp->MenuItems->Add("&About");
Menu = mainMenu;
}
void collegeForm::buttonSave(Object *Sender, EventArgs *Args)
{
validateForm();
formatNames();
}
void collegeForm::buttonClear(Object *Sender, EventArgs *Args)
{
surname->Text = S"";
forename->Text = S"";
courseCode->Text = S"";
dateOfBirth->Text = S"";
supportCode->Text = S"";
male->Checked = false;
female->Checked = false;
parentalHome->Checked = false;
lodgings->Checked = false;
hallsOfResidence->Checked = false;
}
Int32 collegeForm::validateForm(void)
{
errorMessage * em = new errorMessage("This is a test");
em->Size = System::Drawing::Size(400,200);
em->Show();
return(1);
}
void collegeForm::formatNames(void)
{
String * left;
String * right;
String * temp;
if (surname->Text->Length > 1)
{
temp = surname->Text;
left = temp->Substring(0,1);
right = temp->Substring(1,temp->Length-1);
left = left->ToUpper();
right = right->ToLower();
temp = String::Concat(left,right);
surname->Text = temp;
}
if (forename->Text->Length > 1)
{
temp = forename->Text;
left = temp->Substring(0,1);
right = temp->Substring(1,temp->Length-1);
left = left->ToUpper();
right = right->ToLower();
temp = String::Concat(left,right);
forename->Text = temp;
}
}
int __stdcall WinMain()
{
collegeForm *cf = new collegeForm();
cf->Size = System::Drawing::Size(600,600);
Application::Run(cf);
return 0;
}
Simon Cornish
|
|
|
|
|
|
Why should it be on the C++/CLI forum - Its a question about a windows ("Visual") application developed using Visual Studio hence why I posted it on the "Visual C++" forum.
|
|
|
|
|