|
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
|
|
|
|
|
act_x wrote:
How do I get access to the fileName ?
Use CDocument::GetPathName() .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi all
i dared to code a simple 3d viewer with my limited iq. i want to get 2 panes with a vertical static splitter. The left will have a Tree control and right (CMgcCanvas) will draw the model. canvas is derived from CView and OnCreate is overrided. Splitter and tree works well. I added a Messagebox to OnNotify() of CMgcCanvas and CEditorView.
Problem: When i click left pane i can see my messagebox but at right it doesnt work! why?
Note : when i create the tree at right pane, left pane doesnt show messagebox.
Do i create CMgcCanvas wrong?
Thanks In Advance,
Burak
At OnCreateClient proc. of mainframe i did it as ;
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
//calculate client size
CRect cr;
GetClientRect( &cr);
//Create Splitter
if ( !m_mainSplitter.CreateStatic( this, 1, 2 ) )
{
MessageBox( "Error setting up splitter frames!",
"Init Error!", MB_OK | MB_ICONERROR );
return false;
}
//Create pane views of splitter
//Editor - Tree View
if ( !m_mainSplitter.CreateView( 0, 0,
RUNTIME_CLASS(CMGCEditorView),
CSize(cr.Width()/3, cr.Height()), pContext ) )
{
MessageBox( "Error setting up splitter frames!",
"Init Error!", MB_OK | MB_ICONERROR );
return false;
}
//Canvas View
CRuntimeClass* canvas = RUNTIME_CLASS(CMgcCanvas);
if ( !m_mainSplitter.CreateView( 0, 1,
canvas, CSize(cr.Width()*2/3, cr.Height()), pContext ) )
{
MessageBox( "Error setting up splitter frames!",
"Init Error!", MB_OK | MB_ICONERROR );
return false;
}
m_bInitSplitter = TRUE;
CRect leftrect, rightrect;
m_leftpane = m_mainSplitter.GetPane(0,0);
m_rightpane = m_mainSplitter.GetPane(0,1);
m_leftpane->GetClientRect(&leftrect);
m_rightpane->GetClientRect(&rightrect);
//Create Tree Control
m_MgcTree = new CMgcTree;
if (!m_MgcTree->Create(WS_VISIBLE | WS_TABSTOP | WS_CHILD |
TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
CRect(0, 0, leftrect.Width(), leftrect.Height()),
m_leftpane, IDC_TREE1))
{
TRACE0("Failed to create instant bar child\n");
return -1; // fail to create
}
m_MgcTree->Initialise();
//Create Canvas View -???
m_canvas = new CMgcCanvas;
if (!m_canvas->Create(NULL,"Canvas",WS_VISIBLE | WS_TABSTOP | WS_CHILD ,
CRect(0, 0, rightrect.Width(), rightrect.Height()),
m_rightpane, 143))
{
TRACE0("Failed to create canvas\n");
return -1; // fail to create
}
return true;
}
|
|
|
|
|
I had a similar problem with a control that I derived from CStatic for displaying 3D Models (See 'My Articles' below, "A beginning DirectX Application using MFC"). The problem was that I didn't have the 'NOTIFY' style set for the class, so it wasn't receiving any messages. I don't know if that's your problem, but maybe look into that.
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
|
|
|
|
|
well i found the answer.
Microsoft says ;
The framework calls this member function to inform the parent window of a control that an event has occurred in the control or that the control requires some kind of information.
Tree sended the message as a control but i didnt have any at the view pane.
CMgcCanvas::OnLButtonDown works well.
it didnt help but great code .. thanks BlackDice
i'll send my code first to you if it gets out of stupid class!
|
|
|
|
|