|
My problem is that I can not compare the character 13 which is carriage return and the character 10 newLine. I attemp to do f.e
char buffer[10];
if ((buffer[ct]==\13)||(buffer[ct]==\10))
too I have attempt:
if ((buffer[ct]==0x0D)||(buffer[ct]==0x0A))
also
if ((buffer[ct]==char(13))||(buffer[ct]==char(10))
but any other way it works fine. I don´t know why it is the cause. The program entry not for this way.
thanks in advance.
|
|
|
|
|
|
To do character comparisons you would use:
'\r' , '\n' or '\016' (13) or '\013' (10) octal
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
If you use iostreams, then GetLine will work perfectly and you can even set the delimiter.
The std library CANES the MFC container and file classes.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Hi,
does somebody know in which cases ::SymGetModuleBase returns with NULL, unable to retrieve the module ?
Thanks
Oli
|
|
|
|
|
If the function succeeds, the return value is a nonzero virtual address. The value is the base address of the module containing the address specified by the dwAddr parameter.
If the function fails, the return value is zero. To retrieve extended error information, call GetLastError.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
Hi John,
thanks for your answer. What I like to know is when does it fail ? I'm using the method in already running product code and I cannot introduce a call to GetLastError.
Regards
Oli
|
|
|
|
|
Are you saying you don't have the source to the code?
This is a symbolic debugger helper function. If you have MSDN, check it out. There is simply too much info there to post here.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
I have to catch screen and print it into a previous selected printer. I do this two things but when i print the bitmap,using StretchBlt, i get a white and black image. I think that the problem is that the DC i get from de printer, hdc2Bmp = CreateCompatibleDC(hdcPrinter);, has one bit per pixel. Who i can i change this? To get de printer dc i do this:
if (!OpenPrinter((LPTSTR)m_szPrinterName,(LPHANDLE)&hPRN,NULL))
return FALSE;
dpBytesNeeded = DocumentProperties(NULL,hPRN,(LPSTR)m_szPrinterName,NULL,NULL,0);
if (!(lpDevMode = (LPDEVMODE)LocalAlloc(LPTR,dpBytesNeeded)))
return FALSE;
if (DocumentProperties(NULL,hPRN,(LPSTR)m_szPrinterName,(PDEVMODE)lpDevMode,NULL,DM_OUT_BUFFER) != IDOK)
return FALSE;
lpDevMode->dmOrientation = DMORIENT_LANDSCAPE;
lpDevMode->dmCopies = m_iNumCopies;
lpDevMode->dmFields = DM_ORIENTATION | DM_COPIES;
if (DocumentProperties(NULL,hPRN,(LPSTR)m_szPrinterName,(PDEVMODE)lpDevMode,(PDEVMODE)lpDevMode,DM_IN_BUFFER|DM_OUT_BUFFER) != IDOK)
return FALSE;
if (!(hdcPrinter = CreateDC(m_szPrinterDriver,m_szPrinterName,NULL,(CONST DEVMODE *)lpDevMode)))
return FALSE;
Thanks
Have a nice day
|
|
|
|
|
A DC is initially created to contain a "default" b/w bitmap. Creating something compatible with it (obviously) creates something b/w. Try selecting some color bitmap into the source DC first.
++luck;
|
|
|
|
|
hi, i using MS FlexiGrid on VC6. IS there anyway that i can clear cells that contains bitmap ? TQ
LONG LIVE C++! LONG LIVE CODING!
|
|
|
|
|
Hello,
I'm making an application, that should use console, when started from a command line and windows otherwise. It has to work in UNIX too, so it must have main().
The way I've done it, works, but I'm not satisfied with it. When I start it from a command line it works properly, but when starting it as GUI it makes a console window first and then GUI. I would like to get rid of the console in GUI version. I've tried to make console disappear using FreeConsole(), but even though I use it as early as possible the console flashes in the beginning. The other solution I've tried is to use linker options '/entry:"main" /subsystem:windows'. This works fine with GUI, but the console version doesn't do anything.
I hope someone knows a better way to do it.
-Janetta
|
|
|
|
|
I think that the console creation is perfomed during the C library initialization that is performed by mainCRTStartup before your main function is called. You can found mainCRTStartup code into CRT0.C under /crt/src subdir of VC++ installation (if you installed the C library source code, of course).
I never tried to remove the window (I looked at this code only to reduce the size of executables) but you can check the routines called during program startup.
There's a good article about C library initialization by Matt Pietrek:
http://www.microsoft.com/msj/defaulttop.asp?page=/msj/archive/s569.htm
It explain how to reduce executable size but I think it could be helpful also for your pourpouses.
Good luck
--
Looking for a new screen-saver?
Try FOYD:
http://digilander.iol.it/FOYD
|
|
|
|
|
Basically, you're screwed. Seriously.
The only way to get the stdio handles connected to the console starting the app is by having a main() and the app "tagged" as a console app by the PE flags (linker option /subsystem:console). This is one parts of the baggage we carry from Win16.
The default behaviour for a console app to be started is that Windows (I don't know if its the module loader, but I guess it is) allocates a console for a console-tagged app. The only way I know about to change this is to change the flags passed to CreateProcess (to inhibit the creation of the console window). When you have an app that is started by another process (such as Explorer.exe when double-clocking an executable) I can only come to think of hooking (system-wide, loading your DLL for every created process and changing the import translation table) the CreateProcess call to stop it from doing this on a per-application basis.
As I initially wrote, you're basically screwed. Sorry...
|
|
|
|
|
Thanks for both of you for your advice. I haven't found a solution yet, but I'll keep on fighting
-Janetta
|
|
|
|
|
how to change the stock backcolor property of ocx to window background color by default.. i changed it.. it works but the property browser in vb shows application backcolor under systems Tab... for ex. if vb form background is windowtitle... control shows windowtitle in the property browser... but i am getting the correct color in the control....
now my questiong is how to set windowback ground color as default color in my control?
|
|
|
|
|
Hi there, how do I have my application just to run single instance of it. er....eg. Restore the previous instance of the app and then exits.
|
|
|
|
|
When the app starts up, do a check for a mutex. if it doesn't exist create one, and if not then find the existing app and restore it..
something like:
CString strMutexName = _T("MyApp"); // can also use a GUID here
if (!m_hMutex) {
m_hMutex = CreateMutex(NULL, FALSE, strMutexName);
} else {
/* go through all the current windows and restore the existing version of your app. i can't remember how to do this now.. something to do with EnumWindow i'm sure, just don't use FindWindow (heard bad things about it ). */
}
hope this helps.
|
|
|
|
|
|
Using mutex is one way to do so, see MSKB: Q243953
|
|
|
|
|
Look at CSingleInstance in http://www.codeproject.com/library/pj.asp and the other related articles in the "Threads Processes & IPC" section.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
sometimes its nice to pass off the command line from the second
instance to the first. I usually do this with a control struct
in shared memory. First instance creates the control struct and
records its information there. Other instances, read the control
struct and record their command line there, then activate the
first instance, and notify it that their command line has been
recorded before exiting. The first instance handles these as
appropriate, perhaps opening another file, etc.
|
|
|
|
|
Hi all,
Here is a small description of my project:
Users shall be able to send print jobs to a print server. On the print server, the print jobs arrived shallt be managed.
My question/problem:
I need to find a way to restrain a print job from being automatically printed when it arrives to the print server. I am thinking about using “FindFirstPrinterNotification” and “FindNextPrinterNotification” to catch “PRINTER_CHANGE_ADD_JOB” and then immediately ask the print job to delete. Is this the correct approach?
Thank you,
zhu xiao yun
c++
|
|
|
|
|
Hello,
I am using OpenDocument in the Doc class to Load in a DIB. The Load function is in a Dib class I made. After I get this DIB, I want to draw it. I need to call the OnDraw function in the View class to call teh DIb class' Draw function.
I do not know how to send a message from the Doc class to the Load class, saying, "hey, we loaded a DIB, now Draw it"
Can someone please help me out?
Thanks
NickOne
|
|
|
|
|