|
...Or check ON_COMMAND_RANGE, just make sure your buttons have subsequent IDs. Your handler will look like:
void MyApp::OnButton(UINT nID)
{
int nIdx = nID-IDC_BUTTON1;
// handle button by order index
}
Igor Green
http://www.grigsoft.com
Compare It! + Synchronize It! : Files and folders comparison never was easier!
|
|
|
|
|
Hi,
I'm having trouble displaying a picture by overriding OnPaint() method and putting the function SetDIBitsToDevice in there. Here's a bit of the code
<br />
void CProjectorFrame::ShowPattern()<br />
{<br />
m_bBlank = false;<br />
OnPaint();<br />
}<br />
void CProjectorFrame::OnPaint() <br />
{<br />
CPaintDC dc(this);
CRect rClient;<br />
GetClientRect(&rClient);<br />
<br />
if (m_bBlank)
{<br />
dc.SetBkColor(RGB(0, 0, 0));<br />
dc.ExtTextOut(0,0,ETO_OPAQUE, &rClient,0,0,0);<br />
return;<br />
}<br />
else<br />
{<br />
int val = ::SetDIBitsToDevice(<br />
dc,<br />
m_nXOffset, <br />
m_nYOffset,<br />
m_BitmapInfo.bmiHeader.biWidth, <br />
m_nImageHeight,<br />
0, <br />
0,<br />
0, <br />
m_nImageHeight,<br />
m_pImage, <br />
&m_BitmapInfo, <br />
DIB_RGB_COLORS );<br />
}<br />
}<br />
m_MyObject.ShowPattern();<br />
But the pattern doesn't display right after the call to ShowPattern(). I ran this through the debugger and everything seems to work fine. SetDIBitsToDevice actually returns that it set 768 lines, and all the code executes. I'm confused.
Thanks.
|
|
|
|
|
Budric B. wrote:
void CProjectorFrame::ShowPattern()
{
m_bBlank = false;
OnPaint();
}
Never call OnPaint() directly. OnPaint() will be called automatically by the framework when the UpdateWindow() or RedrawWindow() member functions are called. If you call it directly, many of the internal data structures might not be initialized correctly and can lead to all sorts of errors.
"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!
|
|
|
|
|
Any knows, how to write this tool for windows.
What DLLs should I use?
What Methods etc
I want to do this thing in some range of IP
|
|
|
|
|
What about WNetOpenEnum() and WNetEnumResource() ? Or NetShareEnum() ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I wonder if anyone can point me to any literature regarding designing a command driven application like AutoCAD. I already have the GUI (drawing view, command bar, etc.) in place. I now need the command engine to run the GUI.
For example, if the user enters "LINE" at the command prompt, a new thread (I guess) should begin which looks for mouse clicks in the drawing view and keyboard events at the command prompt (for the line's end point coordinates). This thread should not return untill all the required input is gathered, in this case, the two end points of the line to be created. The user can specify the start point of the line by clicking in the drawing view and enter the coordinates of the end point at the command prompt. After this is done the thread returns control to the calling function which creates the line.
Any comments, suggestions, ideas that will help me achieve this will be greatly appreciated.
Thanks.
|
|
|
|
|
I would try looking at apps that use parsing, like the one written by toxcct (whose post you can see below).
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Could find the article. Can you send me a link?
/Deelip
|
|
|
|
|
no need for threading ...
a simple workflow ( or state machine ) to direct the user at what to do.
when a user start a new command, the system wait for an input; if the input is good, then, the system advance to the next event, ... so on and so forth.
for example, for a line command ... ( very pseudo-code )
-Start Line Command <br />
-While ( first point not picked )<br />
wait for user to click or type a valid point.<br />
-if first point is valid<br />
-While ( second point not picked )<br />
wait for user to click or type a valid point.<br />
-if second point valid<br />
Create line with both points.<br />
-End Line Command
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
hi everybody,
how can i, in a dialog dox application, change the default button ?
i've tried to change the styles (SetStyle() or something like that) of the buttons, but it only changes the STYLE, and not the effective function of DEFAULT BUTTON.
any ideas guys ?
thx a lot
TOXCCT >>> GEII power
|
|
|
|
|
From MSDN:
An application sends a DM_SETDEFID message to change the identifier of the default push button for a dialog box.
DM_SETDEFID
wParam = idControl; // identifier of new default push button
onwards and upwards...
|
|
|
|
|
It's already a method of the CDialog class: CDialog::SetDefID()
this->SetDefID(IDC_BUTTON1); works just fine.
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Default button? Check the button properties.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
no, if you did have a look at what i said previously, i've already done this, and, it doesn't change nothing else but the style of the buttons, not the effective default action...
TOXCCT >>> GEII power
|
|
|
|
|
Oh you did. Try not to use any style on that button. This might be a bug.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Maybe you delete the IDOK button, and it is the default button. Start over again, and change the IDOK button as your default button. Got the idea?
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
sorry but...
you're fully wrong !
i need to change the default button programmatically because the default button will change in time depending on several events...
you've got it now ?
TOXCCT >>> GEII power
|
|
|
|
|
Use resource eidt ,set the button default.
|
|
|
|
|
ok, and when i want to change the default property when the program is running, what do i do ?
TOXCCT >>> GEII power
|
|
|
|
|
how can i check if, when i have an entiere path, if the file already exist, and to use it ONLY if the file exist ?
thx for answers...
TOXCCT >>> GEII power
|
|
|
|
|
GetFileAttributes() check for return of (DWORD)-1
or else
_taccess(<filepath>, 00);
There are others, I use the first one.
|
|
|
|
|
BOOL FileExists( const char* pszPath );
There is no spoon.
suhredayan
|
|
|
|
|
What Happen to Great TOXCCT,Long Time NO SEE
any way Simple Api is
BOOL PathFileExists(<br />
LPCTSTR pszPath<br />
);
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
hum, well, could not connect until now... for a short week...
anyway, very thanks to you Mist'Alok
see you
TOXCCT >>> GEII power
|
|
|
|
|
Hi ,
I have a SDI application in which my DOC type is of .xml.
I want to override the standard serialize mechanism to load and Save data but need a handle to the current file (say newDoc1.xml )from within the Doc class as I am externally going to load and save the data using an XML parser object (member of Doc class) . How do I get access to the fileName ?
Thanks
|
|
|
|