|
Well,I saw my errors when I run my App in Window98
err msg look like this: (when I push OK or CANCEL button)
Error1
Error2
Error3
Error4
but when I ran it in my Window XP professional. It login OKAY
"but I have no DSNs" >> what does you mean
|
|
|
|
|
I am writing an MDI application with MFC in VC++ 6.0. I have a (scroll)view class which plots some graphs using data from the document. When I resize the view it flickers quite a lot. Is there any technique that I can use to avoid this? My code is farily standard, doing all its drawing in OnDraw(). I notice that certain apps e.g. VisualStudio and Excel don't seem to have this problem. Also if I resize the main frame, without maximizing the view, if happens flicker-free. How do I implement this in my view?
Thanks in advance for any help.
|
|
|
|
|
The best solution is to simply implement a class that someone has done which features non-flickering upon resize. Otherwise, one possible solution is to not draw the window until resize is complete.
SetRedraw()
Kuphryn
|
|
|
|
|
|
You need to handle OnEraseBkgnd(), because by default if fills the whole client area before OnDraw() is called (flicker flicker). One solution is to disable background erasing and handle all you drawing in OnDraw().
Note: Even if you use a memory DC to try prevent flickering it will still occur if you do not over-ride OnEraseBkgnd().
Trust in the code Luke. Yea right!
|
|
|
|
|
I'm trying to read the command line argument, if the user enters
/s, my program is supposed to do something.
I have:
if(m_lpCmdLine[0] == '/s')
but == does not work for this compare.
m_lpCmdLine[0] is of type LPTSTR. I don't know how to say if the command argument equals /s.
|
|
|
|
|
If your are in MFC,
do something like that in InitInstance():
CString str=GetCommandLine();
if (str.Find("/s")!=-1)
{
code for /s option
}
If not, and your command line is a LPTSTR,
use
if (strstr(m_lpCmdLine[0],"/s")!=NULL)
{
code for /s option
}
You can also use strcmp instead of strstr, but then your command line would be only "/s" to enter the if scope, whereas with this example, you could also have "/s /p -j 897" (it is a substring search, and no direct comparison)).
~RaGE();
|
|
|
|
|
You are almost correct. But remember that when dealing with LPTSTR and TCHAR (as is the case here) you need to use routines from TCHAR.H to avoid problems in Unicode, e.g., _tcsstr instead of strstr and _tcscmp instead of strcmp.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
Use strcmp function to compare strings (or wcscmp for UNICODE). Also, the constant you compare to should be written as "/s" (or _T("/s") for UNICODE).
|
|
|
|
|
m_lpCmdLine[0] is a single character. '/s' is two characters. They are obviously not going to match!
|
|
|
|
|
To check if a string equals another one:
if(strcmp(m_lpCmdLine, "/s") == 0) <what-you-wanna-do-if-it-equals> But you shouldn't do it like this. I suggest you use a command line parser like http://www.codeproject.com/cpp/CmdLineParser.asp[^] (excellent one, try it!).
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
if(!strcmp(m_lpCmdLine[0], "/s"))
or
if(strcmp(m_lpCmdLine[0], "/s") == 0)
choose what you want
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
You need to use TCHAR routines. Ther eis a corresponding TCHAR routine for each of the standard "str" functions. So to compare:
if(_tcscmp(m_lpCmdLine, _T("/s")) == 0)
{
}
Some of the previous comments about using strcmp are technically incorrect, since it would fail for Unicode builds (LPTSTR is an array of TCHARS, not chars!) But as also noted, this is probably not the best way to parse your command line - take a look at the documentation for ParseCommandLine.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
>> if(m_lpCmdLine[0] == '/s')
You really need to take C again (if you did before).
Take a look how C define:
array [0] and 'c' and "string"
|
|
|
|
|
hi there,
i have a problem. now i am developing an application for our client. One of their requirements is that they want to control page numbers, e.g. the maximum page number is 5, when their users print documents, using MS office familiy, such as Word. How should i do?
Thanks a lot in advance.
Evisoh
|
|
|
|
|
If they are printing directly from Word, you can't control how many pages they print. You can, however, provide your own interface and use Word automation to print the document. Then you can control how many pages are requested.
|
|
|
|
|
unfortunately, they have to print directly from word. I suppose that i can use Hook to intercept printing message, however, i have not seen yet any articles about how to intercept printing message. If you guys knew this, i will appreciate your suggestion.
|
|
|
|
|
hu_jia wrote:
unfortunately, they have to print directly from word.
Then why limit them? What good does it do to have a product if you only want part of it to be used?
|
|
|
|
|
that is a human resource center, and every single their user can get maximum 5 pages of printouts. now it is managed by staff, and keep them very busy because of lots of peopel out there. that's why they want to get it controled by compnters.
|
|
|
|
|
Given that they have full control over Word, I see no solution. Not knowing everything from your vantage point, what I've got so far would dictate giving them a little printing utility that limited the number of pages to five. Good luck.
|
|
|
|
|
i will negotiate with them to find alternative if we find no solution. Anyway, thanks a lot. let's keep in touch.
|
|
|
|
|
Can anyone advise me on how to make my console program start minimized?
Thanks all
Digital Khaos
"Diplomacy is dead. Feel my wrath!"
|
|
|
|
|
Here is a good starting point:
http://www.codeproject.com/cpp/cppforumfaq.asp#cons_nowindow
|
|
|
|
|
Ok, I appologize for not reading the FAQ. However, how about make the window non-closeable by the user. graying out the X, or something similiar. Is this an administrative function, or can it be done in code?
Thanks again.
Digital Khaos
"Diplomacy is dead. Feel my wrath!"
|
|
|
|
|
Here's one solution for disabling the Close button:
#include <tchar.h>
BOOL CALLBACK EnumWindowsProc( HWND hwnd, LPARAM lParam )
{
TCHAR a_szClass[64] = {0};
::GetClassName( hwnd, a_szClass, 63 );
if( !_tcsicmp( a_szClass, _T("ConsoleWindowClass") ) )
{
DWORD a_dwWindowThread = ::GetWindowThreadProcessId( hwnd, NULL );
if( a_dwWindowThread == ::GetCurrentThreadId() )
{
*((HWND*)lParam) = hwnd;
return FALSE;
}
}
return TRUE;
}
void RemoveYourConsoleCloseButton()
{
HWND a_hThisConsoleWindow = NULL;
::EnumWindows( EnumWindowsProc, (LPARAM)&a_hThisConsoleWindow );
if( a_hThisConsoleWindow )
{
HMENU a_hMenu = ::GetSystemMenu( a_hThisConsoleWindow, FALSE );
if( a_hMenu )
{
::RemoveMenu( a_hMenu, SC_CLOSE, MF_BYCOMMAND );
::SetWindowPos( a_hThisConsoleWindow, NULL, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_DRAWFRAME );
}
}
}
When you want to disable the close button, call RemoveYourConsoleCloseButton().
Chris Richardson
You can stash and you can seize
In dreams begin, responsibilities U2 - Acrobat[^]
Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your - Rohit Sinha in the content-challenged thread
|
|
|
|