|
Check if the control identifier (13) was already assigned by AppWizard to any other control.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Whats return value in ip ?
|
|
|
|
|
I want to get a value from dynamic ip address control for that purpose i wrote this code
CIPAddressCtrl* ip = (CIPAddressCtrl *)GetDlgItem(13);
ip->GetAddress(dword);
|
|
|
|
|
How do you make this control?
|
|
|
|
|
prathuraj wrote: CIPAddressCtrl *ip = (CIPAddressCtrl *)GetDlgItem(13);
Unless , you are having the control with id 13, nothing wrong with code. Though, I would have used dynamic_cast , instead of c-style cast.
prathuraj wrote: ip->GetAddress(dwIPAddress);
If ip is non-null and controll retunrned in previous statement is of type CIPAddressCtrl , there should not be any problem.
Can you specify, what problem you are facing.
Prasad
MS MVP - VC++
|
|
|
|
|
ip->GetAddress(dword); Access violation error occured at this line
|
|
|
|
|
prathuraj wrote: Access violation error occured at this line
Because ip is invalid.
|
|
|
|
|
As sated in one of previous post, make sure, id 13 is assigned to control you are talking about.
Prasad
MS MVP - VC++
|
|
|
|
|
control id is correct.but pointer is null.what i do further
|
|
|
|
|
Try this code instead (run in a debug build):
CWnd *pWnd = GetDlgItem(13);
ASSERT(pWnd != NULL);
ASSERT(dynamic_cast<CIPAddressCtrl*>(pWnd) != NULL);
CIPAddressCtrl *ip = static_cast<CIPAddressCtrl*>(pWnd);
If the second line asserts in a debug build the id is wrong.
If the third line asserts in a debug build the CWnd returned was not a CIPAddressCtrl and your cast is in error. Try adding a member variable (using ClassWizard in MSVC6); this step makes calling GetDlgItem unnecessary. If this line fails to compile enable RTTI (just in the debug build) and try again.
If the fourth line fails to compile CIPAddressCtrl is not derived from CWnd .
Don't use C-style casts!
Steve
|
|
|
|
|
Typically, the wizards assign control IDs starting at 1000 - perhaps the ID you chose (13) is actually some other control that has been assigned by Microsoft.
It could be that by simply changing your ID (perhaps to something like above 1000, you may be ok as long as that ID isn't used elsewhere in your project.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
How to check if a valid document file is loaded in SDI application?
Actually I want to do some actions only after a file is opened. and also want to enable/disable filemenu save, save as submenus and save tool bar button.
Any suggestion?
Thanks
|
|
|
|
|
Hi,
loaded with Serialize () or loaded with CFile open and read?
And what do you mean with "valid"? If your program has an extension, it would load only files with this extension, and the serialize () already has some checking functions that says "this file is not valid" or "error by loading"
Please explain yourself a bit more
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
i'm having two dialog boxes and a formview..now i want t combine all these in a single view..that is the resultant application should contain the formview and one dialog bix at side of form view and another at the down so that if we want we can close those dialog boxes as in vc++ editor(msdev)..,
i thought to try with plug ins..,as for plug ins are concerned i'm not getting any clear material to know about it..shall i try with plug ins..,if so how...or any other method...
Please help me by ur suggestions..thanx n advance..
P.S:All the dialogboxes nd formview are seperate programs...
|
|
|
|
|
Hi,
why don't you try with a splitter window and 2 CFormViews? Or a DialogBox in NonModal message that you change the size and position in its OnInitDialog () with SetWindowPos () without caption and frame if you want (you can change this in resource editor or using WS_ styles and flags.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
hi nelek,
actually i've designed one dialog box with treeview,another with tab view,and formview is an editor as vc++ editor..
more or less i've to create vc++ lookalike editor...so if we want to close treeview we have to close it,so the other dialog box nd formview...
in splitter window v can't close seperate windows!!(isn't it?)
|
|
|
|
|
Hi mirraa,
actually you can close all the opened windows/dialogs in one touch. For example, in my app (MDI in VC++ 6) I have one CScrollView as MainView and up to 48 CFormViews for each element I want to introduce its parameters. When I close one SecondaryView I close it, and when I close the MainView I close ALL the others. I do this with:
BOOL CMyDoc::CanCloseFrame(CFrameWnd* pFrame)
{ int nError = 0;
CView* pFrmView = pFrame->GetActiveView ();
if (pFrmView->IsKindOf (RUNTIME_CLASS (CFormView)))
return TRUE;
POSITION pos = GetFirstViewPosition ();
while (pos)
{ CView* pView = GetNextView (pos);
if (pView->IsKindOf (RUNTIME_CLASS (CFormView)))
{ CFrameWnd* pTempFrame = pView->GetParentFrame ();
if (pTempFrame)
pTempFrame->DestroyWindow ();
}
}
return CDocument::CanCloseFrame(pFrame);
}
The only difference with the DialogBoxes is that you don't have this list for opened Views in Document. But you can also made it by yourself. Just create a CWnd* dlgArray [MAX] or hWnd dlgArray [MAX] and, in every DialogBox, take a pointer (or a handle, whatever you like more) to the opened DialogBox in the OnInitDialog. Afterwards you can close them as well with a call to DestroyWindow, CloseDialog or other functions like those.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
actually i couldn't understand ur logic..i need all the dialogbox and formview in a single appln as vc++ editor ,so that i can close them with mouse..my project is exactly like a vc++ editor...shall i use plug ins?if so how...?how 'll i combine three programs in a single program..since my dialog with tree view s a sep pgm,my tabview dialog is a seperate pgm nd form view is a sep pgm...please suggest me ...thanx n advance...
|
|
|
|
|
Then I would make it with a SDI application not with dialogs, and make a splitter window to add two views more. At left, one CTreeView derived to the "explorer", then a CSrollBar derived to work with and the third... it depends on what you want to make. The problem of using more views, is that you can not change to a new doc if you dont close all views, at least in my project. Because of that I'm using that function to close the "added" views first when I close the main view.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
I'm new to programming and Visual C++ .NET 2003 Professional. Can you suggest a training reference/book/video/website/??? that would help me understand how to make use of this programmoing tool? The programming text by Deitel and Deitel that I use doesn't even cover the subject of how to make use of the debugger.
Thanking you in advance for your help and time.
|
|
|
|
|
You can set a break point in a function. While executing the application in debug mode(you can run the application by pressing F5 key) the application would run to the first breakpoint encountered. After that you can step into debugger for line by line debugging by pressing F10 to execute a statement.
You can also search for other debugging techniques that are scattered on the Web but I don't think you would find a point where you get to know all the tips and tricks under one topic.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
7.25 GB (7,792,175,104 bytes) is what windows says. -797759488 bytes is what findfile .GetLength() says what do i need to do to make it show as 7.25 gb?
|
|
|
|
|
|
no matter what i try i cant get it to work right files under 2 gb is right but anything bigger is wrong
|
|
|
|