|
Had the same problem once. The standard sort() algorithm won't work with lists. I can't remember exactly why, something to do with iterators.
As a workaround, the list container has its own sort() function...
So change
sort(customerList.begin(), customerList.end());
- to -
customerList.sort();
and it should work.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Work it did! So close but yet sooo far! Thanks a lot!!!!
|
|
|
|
|
If I wanted anti-aliased images in my listbox would it be best to use an XP manifest or a custom CImageLIst to render the ICONS/BITMAPS so the alpha channel is used???
I have read a few articles and it seems manifest would be the easiest way...but not compatible with anything other than XP.
When you use a manifest, does CImageList now use the alpha channel in a 32bit image???
I have read a few articles:
like this one[^]
That suggest Windows forms (assuming .NET something NOT MFC) Image lists have a bug which causes alpha channels to be ignored???
I'm looking for the easiest solution...so if manifest file does exactly what I need done (Basically my controls need to use the alpha channel when rendering cuz I hate the jaggies) then i'll use the manifest appraoch.
If the manifest causes alot of other problems, from which I can tell from the articles I have read here on CP seems to bugger up other controls, etc...then maybe i'll consider writting a custom CImageListXP class which renders any bitmap using alpha channels...plus I guess it could be used in 98, etc...which would be nice but not nessecary...
Does a manifest sound like something I should use or should I write a CImageList class???
If I should use a manifest can you point me to an article which guides me through it and doesn't cause any weird side effects on combobox drop downs, etc...?
Thanks
How do I print my voice mail?
|
|
|
|
|
Add Testbox as a contral var.
Add button event.
Use SetWindowTex() to change Testbox.
|
|
|
|
|
http://winprog.org/tutorial/controls.html
wWw.KruncherInc.cOm
|
|
|
|
|
Do I need to do something special to run a 16-bit program using CreateProcess. My function works with "cmd.exe" but when I call the 16-bit program I want to use, I get a stack overflow.
Thanks a ton!
Mike
Here's my code:
BOOL CGeneral::CreateGENLAMProcess()
{
PROCESS_INFORMATION myPI;
STARTUPINFO mySI;
BOOL bFuncRetn = FALSE;
// Set up members of the PROCESS_INFORMATION structure.
ZeroMemory( &myPI, sizeof(PROCESS_INFORMATION) );
// Set up members of the STARTUPINFO structure.
ZeroMemory( &mySI, sizeof(STARTUPINFO) );
mySI.cb = sizeof(STARTUPINFO);
// Create the child process.
bFuncRetn = CreateProcess(NULL,
"genlam.exe", // my program name
NULL, // process security attributes
NULL, // primary thread security attributes
TRUE, // handles are inherited
0, // creation flags
NULL, // use parent's environment
NULL, // use parent's current directory
&mySI, // STARTUPINFO pointer
&myPI); // receives PROCESS_INFORMATION
if (bFuncRetn == 0) {
AfxMessageBox("CreateProcess failed");
return 0;
} else {
CloseHandle(myPI.hProcess);
CloseHandle(myPI.hThread);
return bFuncRetn;
}
}
|
|
|
|
|
Hi I tried it on XP home and 2000 and this worked with 16's
SHELLEXECUTEINFO sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof (SHELLEXECUTEINFO);
sei.lpVerb = NULL;
sei.lpFile = csstr; // passed filename
sei.nShow = SW_SHOW;
sei.hInstApp = NULL;
sei.lpDirectory = NULL;
sei.fMask = SEE_MASK_DOENVSUBST|SEE_MASK_NOCLOSEPROCESS;
sei.lpParameters = NULL;
if (ShellExecuteEx (&sei) )
return TRUE;
else
return FALSE;
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
Hi,
I forgot to mention that I'll be piping information to/from the child process. I seem to remember there was some reason for choosing CreateProcess over ShellExecute. Will the program inherit the pipe handles?
Thanks,
Mike
|
|
|
|
|
Yes, use a thread and rerurn a handle.
PJ and Dr. N both have good articles on these.
PJ. www.naughter.com
and Dr. N www.flounder.com
P.J. example is in popwatch
Dr. N's is called worker threads I believe..?
Anyway create a handle
HANDLE myproject::StartShell(blah,blah,blah){
ShellExecute or CreatePro
return hwnd;
}
CP has a good artice also called A newbie's elementary guide to spawning processes.
Nishant does a good job, but does not go into the depth of the articles above.
Dr. N. is hard to read, but once you understand him he provides great info on both these subjects.
A good article appeared in March 1998 in MSDN Journal.
"Extend the Windows 95 Shell with Application Desktop Toolbars "
Notice how they managed the threads both worker and UI.
Also look at blade and the many win UI's that shell it. Notice they have setup two way communication between the com object and the UI.
Most all rippers include blade as the workhorse.
Also WinLame uses two way between the GUI and the com obj (LAME)
Another option is to create Custom Messages and post them. In your child process trap em in the default process and extract the params.
You may also create a defwinpro in the spawner and trap message back from the child app.
Remem to create a header with the defines and include it in both apps.
pcode:
#define my_message ((WIN_USER)+1024);
CStringArray message;
Message.SetSize(0,1999);
message.Add(2,"please insert new disk into drive A:")
...
message.Add(99,"Please remove disk from drive A:");
...
PostMessage(my_message,0,99);
= Remove disk from drive A:
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
MFC is confusing to me. Can someone explain how I insert any class of my own into a MFC "skeleton" program and then have the data my class(s) contain displayed and save.
I'mm new to MFC especially the Doc/View stuff.
C++ is my favorite programming language
|
|
|
|
|
|
Oi guys, trying to create a simple calendar and have 42 static text boxes with names box_1 through box_42. How can I increment from one box to another(lets say go from box_1 to box_2 ) inside a for loop, becasue I need to change the text to the corresponding number of days in the month, so the boxes are going to change depending on what month and or year it is.
ex: first day of month starts on tuesday so box_3 needs to have the text in it be 1, so I want a for loop that will continue changing the text of each one until we run out of days in the month
something like this
for(int N = 1 ; N < days_in_month ; N++)
{
box_N.dlgText = N
}
I know this is pretty low level stuff, but I havent used MFC in a long time and I'm stumped lol
Thanks
Pete
|
|
|
|
|
I would make sure the static text boxes have consecutive IDs, and access them via GetDlgItem() calls
for (int N = FIRST_ID, N <= LAST_ID, ++N)
{
GetDlgItem(N)->SetWindowText
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
I'm looking for some SNMP code examples... just somthing straight forward, in C++/MFC ... I have found many pre-compiled libs, and some COM stuff... but I'm interested is just some Plain C++ or MFC code....
Anyone want to share some bookmarks ?
qcha0s
|
|
|
|
|
Hi
MSDN has some sample of Simple Network Management Protocol SnmpUtil and Testdll.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample98/html/vcsmpsnmp.asp
Guess you know about these, pleaase also serch for a company called logiair as they were building a compiler for had completed a couple of libs.
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
soruceforge.net has many programs. just type SNMP in the search box and start looking.
Watch the license though, some of it is GPL which you cannot copy.
|
|
|
|
|
Hello,
I wrote an appli in VC++ that interfaces a database MySQL to store my data, both are linked by ODBC.
I would like to avoid to make too many costly DB extractions in my DB to fill a list, I would like to verify if my DB table content has been modified till last extraction.
Looking at MySQL doc, I found the request "SHOW TABLE STATUS LIKE 'Clients'" that returns a certain numbre of infos on the table and, in particular, the date/time of last update.
But, I have no idea on the way to launch this request from VC++ and retrieve the infos.
Hereunder is what I usually do to send my requestes (i.e. for a select):
---------------------------------------------
DBName = GlobalDSNIGS + ";UID=;PWD:";
res = "SELECT CleClients,CL_Lastname,CL_Firstname from Clients WHERE (CleClients > 0)";
gDB.OpenEx(DBName,CDatabase::noOdbcDialog);
TRY
{
rs.Open( CRecordset::forwardOnly, res );
NbRecord = rs.GetRecordCount();
}
CATCH(CDBException, e)
{
ErrMsg ="**ERR: "+e->m_strError;
}
END_CATCH
if ((ErrMsg == "") && (NbRecord > 0)){
while(!rs.IsEOF()) {
rs.GetFieldValue( "CleClients", Nbr);
rs.GetFieldValue( "CL_Lastname", Lastname);
rs.GetFieldValue( "CL_Firstname", Firstname);
ID = BLANK.Left(10-strlen(Nbr)) + Nbr; // justify on 10 char
// m_GuestsList.AddString(Lastname + "-" +Firstname+" / Guest# : "+ID);
rs.MoveNext();
}
}
rs.Close();
gDB.Close();
-------------------------------------------------------------
Is there a way to do this or even onother way to retrieve this last date/time infos?
Thanks in advance for you answer
DD
|
|
|
|
|
Hi all,
As I know that CDialog is a MFC class. And I looked in MSDN to find its destructor and constructor. I really don't know when CDialog is destroyed by a destructor? Does it has its own destructor? When I used the method CDialog::OnOK or CDialog::OnCancel(), is it a way to call CDialog's destructor?
By the way, in VC++ or C++, is there a garbage collector like there is in Java? I wonder why Java can do what VC++ can without pointer.
What are the advantages and disvantages of pointer?
What is the most dangerous thing you have to be aware of when trying to use pointer?
Why VC++ program usually gets runtime error? Is it because of pointer?
Thanks for reading!
|
|
|
|
|
that's a boat load of questions ...
1- CDialog receives a message ( WM_DESTROY or something like that ) when it's destroyed. The problem with dialogs, is that it must be destroyed from within, when the user clicks on ok, it will call EndDialog, which will do a bit of cleaning. MSDN has a lot of good documentation on the Life Cycle of a Dialog Box .
2- I don't know Java, maybe them implement pointers, but are hidden from the user; and only handled by the memory manager ( and garbage collector ).
3- pointers dis/advantages .. both have their use, pointers, are easier to use when passing information to functions and methods, if not using pointers, and passing a class to a function by value the class will be copied, a loss of time and memory. There are tons of other examples this ... google for it.
4- pointers can be NULL ...
5-yes, sometimes, but mostly for bad memory management and handling.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Thanks. I got your ideas.
But you know, in my project, I can get the value of a public member variable of a dialog after I click Ok or Cancel (I means, at that time, the dialog disappears). If WM_DESTROY message really destroys CDialog object then how come I can get the value of its public member variable?
Example:
When I want to confirm the user when he/she deletes something by showing a confirmation message. If the user clicks Ok when the user confirms that he/she intentionally deletes, and clicks Cancel when the user rethinks not to delete.
bool m_bPressed; // get the status of the confirmation dlg
CConfirmDlg dlg;
dlg.DoModal();
m_bPressed = dlg.m_bAgree; //m_bAgree is the member variable of
//CConfirmDlg which indicates Ok or Cancel button is pressed
if (m_bPressed) // user clicks OK
//do something
else //user clicks Cancel..
//do something
Thanks for reading!
|
|
|
|
|
(my bad )
WM_DESTROY destroy the dialog "window", not the dialog class.
in your example, the dialog class will be created when the variable in instanciated, the dialog "window will be created at the DoModal call.
the dialog "window" will be destroyed when the DoModal finish, and the class will be deleted when the variable goes out of scope.
that's one reason you cannot access UI controls of your dialog before the dialog "window" is created; or after it is destroyed.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Thanks, it's clear enough. But I don't really understand what you meaned "out of scope". So when object of CDialog is totally destroyed (not its "window")?
Thanks for reading!
|
|
|
|
|
"out of scope" ... basic C/C++ concept.
when you declare a variable on the stack in a function ( or withing {...} the variable is deallocated and "destroyed" when the it leaves the current scope ( either the end of the function or the matching } .
for example (on the stack):
void SomeClass::SomeFunction()
{
AnotherClass myClass;
}
on the heap :
void SomeClass::AnotherFunction()
{
AnotherClass* pMyClass = NULL;
pMyClass = new AnotherClass;
delete pMyClass;
}
So to answer you question, the CDialog object will be destructed at the end of the function.
void SomeClass::YetAnotherFunction()
{
CDialog dlg;
dlg.DoModal();
}
or
void SomeClass::YetAnotherFunction2()
{
CDialog* pDlg;
pDlg = new CDialog;
pDlg->Create( );
pDlg->ShowWindow(SW_SHOW);
delete pDlg;
}
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
WIN Management WMI Service (64 bit env on IA-64) doesn't seem to load 32 bit dlls (don't know why).
We have confirmed this by removing load call for 32 bit dll, after removing this call, it works fine.
Need to find some solution as we can not have 64 bit version of that dll. Or do we have to some setting
to load it.
Please let us know if anyone has any idea
Thanks and Regards
Deepak
|
|
|
|
|
did you try using the dll help loader?..
Sovled my beta issue.
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|