|
Thanks for the replies.
I am using the vArg to clear the header and footer so that the default Internet Explorer text does not appear on my printout.
It was a while ago, but I think this I got the code from a Codeproject article. Does it look ok to you?
I can't disable it to see if the problem goes away because its on a live manufacturing system and the problem never happens for me (of course)
Joanne
SAFEARRAYBOUND psabBounds[1];
SAFEARRAY *psaHeadFoot;
// Initialize header and footer parameters to send to ExecWB().
psabBounds[0].lLbound = 0;
psabBounds[0].cElements = 2;
psaHeadFoot = SafeArrayCreate(VT_VARIANT, 1, psabBounds);
VARIANT vHeadStr, vFootStr;
VariantInit(&vHeadStr);
VariantInit(&vFootStr);
// Argument 1: Header
vHeadStr.vt = VT_BSTR;
vHeadStr.bstrVal = SysAllocString(L"");
// Argument 2: Footer
vFootStr.vt = VT_BSTR;
vFootStr.bstrVal = SysAllocString(L"");
// SAFEARRAY must be passed ByRef
VARIANT vArg;
VariantInit(&vArg);
vArg.vt = VT_ARRAY | VT_BYREF;
vArg.parray = psaHeadFoot;
LONG rgIndices = 0;
SafeArrayPutElement(psaHeadFoot, &rgIndices, static_cast<void *="">(&vHeadStr));
rgIndices = 1;
SafeArrayPutElement(psaHeadFoot, &rgIndices, static_cast<void *="">(&vFootStr));
|
|
|
|
|
Setting the background color in response to WM_CTLCOLORBTN appears to have no effect because if you're not running a theme-aware OS, or running a theme-aware OS in classic mode, the button face covers the entire client area, so no background shows through. If you run XP in the default theme, the button has rounded corners, so a bit of the background will be visible.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
|
|
|
|
|
The WM_CTLCOLOR message requires that you return a HRUSH for the background color. SetBkColor() doesn't work here. I assume WM_CTLCOLORBTN etc. are the same.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
WM_CTLCOLORBTN: only owner-drawn buttons respond to the parent window processing this message.
Note: This message is a request for the handle to the brush that the system needs to paint the background of the button.
// Example
case WM_CTLCOLORBTN:
// create bush or use precreated brush
return mybrush_handle;
INTP
|
|
|
|
|
yes I know about returning the brush, I'm just copying and pasting my WM_CTLCOLORSTATIC code into the WM_CTLCOLORBTN and it doesnt work.
wWw.KruncherInc.cOm
|
|
|
|
|
Is the button owner-drawn? Only owner-drawn buttons respond to WM_CTLCOLORBTN message.
INTP
|
|
|
|
|
Why does WM_CTLCOLORBTN not work, it doesn't respond to things like SetBkColor and such like WM_CTLCOLORSTATIC does. Whats up with that?
wWw.KruncherInc.cOm
|
|
|
|
|
Not even sure if the subject made sense. Anyway, I am trying to sort a linked list that contains a class. I thought overloading the operators would do it, but apparently not. Getting serious errors! The best way to describe is to see the code. here it is. Any help would be much appreciated.
#include <iostream>
#include <string>
#include <list>
#include <algorithm>
using namespace std;
class customerType{
public:
customerType (string f, string l, int acct){
first=f;
last=l;
accountnum=acct;
}
bool operator==(const customerType& right) const{
return (last==right.last);}
bool operator!=(const customerType& right) const{
return (last!=right.last);}
bool operator<=(const customerType& right) const{
return (last<=right.last);}
bool operator<(const customerType& right) const{
return (last<right.last);}
bool operator>=(const customerType& right) const{
return (last>=right.last);}
bool operator>(const customerType& right) const{
return (last>right.last);}
private:
string first;
string last;
int accountnum;
};
void main()
{ list<customerType> customerList;
customerType customer1("Joe","Schmoe", 9999);
customerType customer2("Moe","Ghoe", 11111);
customerType customer3("Loe","Adner", 4232);
customerType customer4("Roe","Boat", 4444);
customerList.push_front(customer1);
customerList.push_front(customer2);
customerList.push_front(customer3);
customerList.push_front(customer4);
cout<<customerList.size()<<endl;
//uncomment the line below for major errors!
// sort(customerList.begin(), customerList.end());
};
|
|
|
|
|
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
|
|
|
|