|
How do I change the color of the edit portion of a CDateTimeCtrl
|
|
|
|
|
Have you looked into the WM_CTLCOLOR message, or the OnCtlColor() handler?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Yes I have tried both, but they dont appear to work with CDateTimeCtrl's
Thank You
|
|
|
|
|
What about overriding PreSubclassWindow() in your derived class and changing the color there?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
hi,
I have created a dialog using Cproperty sheet but facing difficulty while setting the focus on Help button from Cancel button and vise-versa using arrow keys, though using tab it works properly. Also, its not using Active Control X.
|
|
|
|
|
You need to look into the WS_GROUP style.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi there!
I'm quite new with C++, using other languages but now i needed to write an Printer USB routine in C++, and i need some help!
It's like this
BytesToWrite = sprintf( (char *) szBuffer, "\033F\r\033B 512 600 4 1 2 3 150 1 999999999\r\033I\r");
WriteFile( hDevice, szBuffer, BytesToWrite, &cbWritten, Null);
etc, etc, etc
I need to replace the 999999999 with the first command line argument (paramstr(1) Can someone help me with this!?
What this function does, is to send ESC commando codes to an Zebra Eltron printer.. Print barcode.. 999999999 is the barcode, but i need be able to call this little application from another application then with the barcode as command line argument.!
Best regards
Andreas
|
|
|
|
|
andreas_sweden wrote: I need to replace the 999999999 with the first command line argument (paramstr(1) Can someone help me with this!?
Does your program have a main() function?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi, yes!
Srry, didn't mention.. but here it comes!
int main(int argc, char* argv[])
{
TCHAR DeviceName[1024];
HANDLE hDevice = NULL;
DWORD cbWritten;
DWORD cbRead;
BYTE szBuffer[1024];
DWORD BytesToWrite;
StringType SlumpNum;
// This function enumerates the printer class devices and detects the appropriate
// device
CCmdLine cmdLine;
EnumeratePrinter(( LPGUID) &GUID_CLASS_ZEBRA_USB,
DeviceName,
PRINTERNAME);
hDevice = CreateFile(DeviceName,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
// Read Ribbon
BytesToWrite = sprintf( (char *)szBuffer,
"\033!RIBBON\r");
WriteFile( hDevice,
szBuffer,
BytesToWrite,
&cbWritten,
NULL);
// To read you need to send "\033E 2\r"
BytesToWrite = sprintf( (char *)szBuffer,
"\033E 2\r");
WriteFile( hDevice,
szBuffer,
BytesToWrite,
&cbWritten,
NULL);
ReadFile( hDevice,
szBuffer,
1024,
&cbRead,
NULL );
// End of ribbon read
// Start Encode Data
// Fill in the data in firmware buffer
// First track ZEBRA1 command: \033&B 1 ZEBRA1\r
// Second track Age command: \033&B 2 28\r
// Third track YOB command: \033&B 3 1975\r
// Encode all three track
// command: \033E*\r
BytesToWrite = sprintf( (char *)szBuffer,
"\033F\r\033B 512 600 4 1 2 3 150 1 999999999999\r\033I\r");
WriteFile( hDevice,
szBuffer,
BytesToWrite,
&cbWritten,
NULL);
And you can see the 999999999999 that i would like to insert the first command line parameter instead...
Regards
Andreas
|
|
|
|
|
andreas_sweden wrote: int main(int argc, char* argv[])
Command-line arguments are supplied in the argv (argument vector) variable.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi again, thankyour for answering so quickly.
May i ask you to be a little more specefic.. since i no 1% of c++ . well, not really but almost..
I havn't the got the clue how i must do to get that inserted at that position where i needed it..
If you had time to help my it would be very kind!
Thnakyou !
/Andreas
|
|
|
|
|
andreas_sweden wrote: since i no 1% of c++
Actually it has nothing to do with C++. See here and here for more.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Okey, so one step further .. guess i used the argv correct
same as ParamStr in Delphi and so on.
Ok, now i'm having trouble to inserting that string into the function.
Like this, wich doesn't work:
Argument = argv[1];
BytesToWrite = sprintf( (char *)szBuffer,
"\033F\r\033B 512 600 4 1 2 3 150 1 "&Argument&"\r\033I\r");
Thankyou!
/Andreas
|
|
|
|
|
andreas_sweden wrote: BytesToWrite = sprintf( (char *)szBuffer,
"\033F\r\033B 512 600 4 1 2 3 150 1 "&Argument&"\r\033I\r");
Try:
sprintf(szBuffer, "\033F\r\033B 512 600 4 1 2 3 150 1 %s\r\033I\r", argv[1]);
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Thankyou thankyou * 10000
Very much!
Everything works just fine!!!
Mucho Gracias!
/Andreas
|
|
|
|
|
I've tried to overload the << oprator, so that I can output to a file and to a console at the same time but I have no success. I cannot find a solution in Internet and I get the error message: ambigous overload of operator <<...
Any ideas what to do?
I want to be able to use this operator to output something like:
logfile << "data";
but still to be able to do this:
cout << "out";
Thank you!
|
|
|
|
|
i'm not sure i understand.
you want - in the same << operation - that your datas are written both in a file and in a console ?
there's no need to overload such an operator for this.
you write a function say writeOutput(data_to_write) in which you perform a cout << data and a file << data where file is an ifstream opened with the file to write...
if not, please explain more clearly...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|
|
Yes you are right but I want to be able to use variable number of arguments but I don't want to use va_list, etc... C functions.
|
|
|
|
|
Cristoff wrote: but I don't want to use va_list, etc... C functions
however, it is the way to do it...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|
|
I have done it that way but according to samples I've found in Internet, it has to be possible to do it with overloading << but I cannot get it to compile.
|
|
|
|
|
Cristoff wrote: I've found in Internet
can i know this place ?
Cristoff wrote: but I cannot get it to compile.
any chance to have a look at your "not-compiling" code (i don't want it all, i need only a piece of code to understand how you try to achieve the point we're talking about) ...?
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|
|
Thank you very much for wanting to help me. The problem is that I've deleted it yesterday and I cannot find it now, although I'm searching it yet for my own needs.
If I find it, I'll post it later.
Thank you!
|
|
|
|
|
I don't understand how varargs fits into overloading << ?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
|
VivekuniQ wrote: is it really possible to overload a ">>" ??
this is not what we're talking about, but to answer your prompt question, yes it is !!
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|