|
Dudi Avramov wrote: I need sources.
And one day you will call yourself a programer? I will call you a "Copy and Paster"!
|
|
|
|
|
In my SDI CFormView based application (Visua C++, Window2000), a CFileDialog type dialog box is used to select files. The dialog box works fine if I directly click the button to bring up the dialog box. However, if i click some other buttons to run some other routines before clicking the button for bring up the dialog box, then SOMETIMES the dialog box did not come up .
The code for the button click (to bring up the dialog box) handler is shown below.
<br />
CFileDialog * Cfieldialog = new CFileDialog(true, NULL, NULL, OFN_NOCHANGEDIR|OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Text Files (*.txt)|*.txt|All Files (*.*)|*.*", NULL );<br />
<br />
Cfieldialog->DoModal();<br />
<br />
CString CStringTest = Cfieldialog->GetPathName();<br />
((CEdit*)GetDlgItem(IDC_EDIT_ExampleText))->SetWindowText((LPSTR)(LPCTSTR)Cfieldialog->GetPathName());<br />
<br />
delete Cfieldialog;<br />
<br />
<br />
This problem is biting me hard. Any help and hints would be appreciated very mcuh.
|
|
|
|
|
The filter is supposed to end with two ‘|’ characters.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I think problem is somewhere else - you said that if you click others buttons the it won't work. Try to find which exactly routine occurs unstable application proceeding.
-----------
Mila
|
|
|
|
|
Hello comunity,
how to get an pointer to an control that is on CTabCtrl placed, my problem is the grid control that is
on dialog in CTabCtrl!
Have Main Dialog with CTabCtrl, first tabitem have him own CDialog, and on that is my CGridCtrl whitch
pinter i need!
That is what i try before:
CGridCtrl* pGrid = (CGridCtrl*) ((CSecondDialog*) pMainDlg->GetTab(0))->GetDlgItem(IDC_GRID_LIST);
int iNumLines = pGrid->InsertRow(L"some text");
pGrid->SetItemText(iNumLines, 1, L"some text on column 2");
Is there any error in my cast?
regards
break;
-- modified at 9:41 Monday 20th November, 2006
|
|
|
|
|
I'm very new to C++ and haven't really touched it since 1996 in varsity. I'm now trying to build several chaotic open source projects, and I could use some help on how project structures, include directories, make files etc. all work. I'm basically looking for Teach Yourself to Structure and Build C++ Projects in One Evening, if anyone has seen it somewhere.
|
|
|
|
|
Hi
Suppose we have class that is in a dll, this class has a CString object.
I want to export this class, but I get this warning:
class 'CString' needs to have dll-interface to be used by clients of class
and then I can't access this member of class via my code.
Do you know why?
|
|
|
|
|
|
could i know how can i load active-x control in vc++ at run-time(programmatically).I will be very thankful to you , if you can throw some light on it.
Thanks & Regards,
Praveen A.
praveena@navayuga.co.in.
praveen kumar agarwal.
|
|
|
|
|
Why do you want to load it at run-time, for what reason ?
The purpose of an ActiveX control is not to be loaded at run-time.
You need to have the wrapper classes that are generated when you add the ActiveX to your project. Without these classes, how can you 'communicate' with the control ?
|
|
|
|
|
There are a couple of things worth noting here.
1) you can create a stub class based on an activeX control using VC++'s insert class wizard. This will give you an interface to its methods and properties based on the control's IDL file.
2) Call AfxEnableControlContainer(); (eg in InitInstance or somewhere early on) or nothing good will happen.
) Once you have an instance of the ActiveX stub class class you'll need to call CreateControl on it to instntiate the actual control (note: this may consist of an overridden Create function).
Then you up an running.
Tom
|
|
|
|
|
You make me doubting if I have well understood his question
For me loading the ActiveX at runtime meant that he didn't want to use class Wizard and all these things to add the control to its project but do that at runtime instead.
But we'll probably never know what he wanted to do
|
|
|
|
|
Hmmm... I suppose it depends on what he meant by "load".
I suppose he could have meant trawling through the registry or someone dragging a control onto a page etc.
I just assumed he meant using a control without having first dragged it onto the form design window.
I hope he does respond
Tom
|
|
|
|
|
i meant selecting a control from a list of control without using any wizard. After selection of control just place the same on view window at runtime. even i need to change the control property at runtime as desired by me.
It is like drag and drop control from toolbox on to view window, but instead of runtime samething i want to implement at runtime.
waiting for your reply.
Thanks in advance for the help.
Praveen A.
|
|
|
|
|
Thanks for the reply. yes, I meant adding control at runtime without using class wizard. I want to provide an option to user by which he can load active-x control at runtime and can set the property dynamically.
Thanks & Regards,
Praveen A.
praveen kumar agarwal.
|
|
|
|
|
Hi
Right then...
In order for your app to be able to behave as a container you'll have to have selected Container on the Compound Document Support form when you created your app (or you'll have to set the framework up your self). You'll also have to have a Doc/view architecture but I believe you already mentioned you were using one
One the project is created you'll find a method called OnInsertObject in your view class. If you follow the help files you'll probably be fine from here on, just remember that it's all about the IDispatch interface. If your not sure what that is you'll certainly make your life easier if you look into it.
All the best
Tom
|
|
|
|
|
Hi,
I have 2 questions?
[1] How to create a service application in vc++ ? What are the steps to install this service application and make it run??
[2] How to trap the winlogon events in this service???
A code snippet will be of great help..!!!
Sunil
|
|
|
|
|
sunilpv1982 wrote: [1] How to create a service application in vc++ ?
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all,
i have one class in which i create
tree view control with it's Create method.
e.g
class CDocTree : CSizingbar
{
public :
CTreeCtrl m_wndTreeCtrl;
};
in this way i am working till now
but i am not able to know when someone right clicks on the
node.
actually i want to do something like this if somebody
right clicks on leaf node then i want to display a popup menu at that position and then on some menu event i wanted to show the dialog box.
in this process i want the label associated with that leaf node..
currently i am catching events in this manner
BEGIN_MESSAGE_MAP(CDocTree, CSizingDocBar)
ON_WM_CREATE()
ON_NOTIFY(NM_DBLCLK,1234,OnTreeNotify)//**
ON_NOTIFY(TVN_KEYDOWN, 1234, OnTreeKeyDown)//**
ON_WM_CONTEXTMENU()
END_MESSAGE_MAP()
how i can achieve it
Thanks and regards
Harshal
|
|
|
|
|
Hi,
Try to
ON_NOTIFY( NM_RCLICK, IDC_TREE, OnRclickOnTree )
in OnRclickOnTree, You can send WM_CONTEXTMENU message.
-----------
Mila
|
|
|
|
|
Check the WM_CONTEXTMENU is called for your tree control.
then check the point where right clicked (lParam value has the point)has any item,.. the handle to the tree will be passed in wParam
if so then check it is leaf node (by checking its child you can find out).
Show your context menu and handle occrdingly..
Hope this'll help...
Do your Duty and Don't expect the Result
|
|
|
|
|
I need to convert a vector to an array. It's no problem really, only one thing bothers me. If i use an iterator to iterate through the vector, i have no counter for the array, unless i declare an extra variable for that. If i use a counter to go through the vector, i bypass the recommended STL-way for iterating - iterators. So, does anyone know any elegant way for that ? I know that it's not really a problem, i'm just trying to optimize my solution.
wbr Mr.Brainley
|
|
|
|
|
A vector 's storage is contiguous, so you can do &my_vector[0] to get an (array-like) pointer to the first element.
|
|
|
|
|
Michael Dunn wrote: A vector's storage is contiguous, so you can do &my_vector[0] to get an (array-like) pointer to the first element.
very encapsulated
|
|
|
|
|
The C++ Standard Library requires that the elements of a vector are in contiguous memory. There's no problem with code like Mike suggested and encapsulation has not been violated as the contiguous storage requirement is documented and required behaviour for a std::vector .
Steve
|
|
|
|