|
Makakuin wrote: this->GenDataButton = GetDlgItem(IDC_GENDATA_BUTTON)->m_hWnd;
How can this line compile?
Why don't you map a control variable using the Add member Variable Wizard of Visual Studio?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Sorry - I`ve tried this also - does not work - the GendataButton is valid right after the call to InitDataFields -
if I call InitDataFields() just before a call to GenDataButton->ShowWindow(SW_HIDE) - it works, bu after exiting the OnGenDataButton scope the GenDataButton pointer is emtpy..
|
|
|
|
|
Hi All
How can i read environment variable rom c program
Mohan t
modified on Tuesday, September 29, 2009 2:19 AM
|
|
|
|
|
If you are under windows (using VC++) then you can use GetEnvironmentVariable[^]. Otherwise maybe give getenv[^] a try.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Every C program takes 3 arguments on the main function.
The 3rd parameter is a pointer to the environment block.
int main(int argc, char* argv[], char* envp[])
{
return 0;
}
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi Experts,
I want a CListCtrl with Checkbox and Report View in which some item should be selectable and remaining should not.
How can I do that?
|
|
|
|
|
Try handling the LVN_ITEMCHANGING[^] notification, examine which item is about to change anf if it is one that is not allowed, return TRUE to prevent the selection/checking. Hope that is what you need...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
But I want also make these item different(Not Selectable) from other List Item(Selectable).
|
|
|
|
|
Then you will have to go with ownerdrawn[^] items i believe.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi to All,
In regards to previous problem of mine,...I have made an overloaded construtor of dialog class in dialogB...Now while creating the object of the dialog , I am passing the variables...No problem the overloaded contrctor of dialogB calls fine. But again, the default constructor is getting called. Why so?
my code line to create the dialog is...
dialogB obj = new dialogB(&m_boardMainPage,&m_portMainPage,&m_extMainPage);
obj.DoModal();
I need to create the dialog with overloaded constructor (in order to pass some valued to that dialog)..Please help me.
-----------------------------
I am a beginner
|
|
|
|
|
You have classA, and classB inheriting from that.
You make a new classB, and both classB::classB() and classA::classA() are getting called?
This is not a bad thing. This is a GOOD thing.
Imagine if this was not the case. CDialog is a slightly complex class. You make a new dialog. Your constructor would have to do all the special work of your new class. AND ann the special work of a CDialog. AND all the special work of a CWnd. AND all the special work of a CObject.
(It's turtles all the way down).
If you want to control which CDialog constructor gets called, you need to do the following:
CMyDlg::CMyDlg (CWnd *pParent)
: CDialog (IDD_MYDLG, pParent)
{
In addition - the base class constructor gets called first. Again, imagine if it was the other way around. All the stuff not included in the inheriting class would be uninitialised.
I hope that helps,
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
A guess what's causing this behavior: If you pass a variable of class dialogB in a function call, the default constructor will be called to create a second instance of dialogB.
If this is happening and you want to avoid this behavior, pass the address of the dialogB object, rather than the object itself.
|
|
|
|
|
Hi to All,
Could anyone please help me with my following problem.
Basically, I need a way to pass values between different dialog. Following is exactly what my requirement is.....
I have a property page, from where I am opening an another dialog (modal), to enter some values. Now I want those values back in my property page, once the user closes the modal dialog. PLease help me with it.
Thanks in advance.
-----------------------------
I am a beginner
|
|
|
|
|
You can use 'SendMessage()'function
|
|
|
|
|
thanks for your reply..
Could u please elaborate a little bit.I am new to MFC
Thanks
-----------------------------
I am a beginner
|
|
|
|
|
This is pretty classic MFC stuff.
You have a propert page called CMyPropertyPage. It has two controls on it.
1) A button called "press me". Use class wizard to associate this with a function OnPressMe.
2) An edit control (or a static control, I don;t care). Again, classwizard, associate with a CString called m_hrishiS.
When you press the button, you want a dialog box to pop up. This box has been made already, and is called CMyDlg. This has a single edit control on it. Using class wizard, you've associated this edit control with a class member m_MyString.
So, your function would be like...
void CMyPropertyPage::OnPressMe ()
{
UpdateData (TRUE);
CMyDlg dlg (this);
dlg.m_MyString = m_hrishiS;
if (dlg.DoModal () != IDOK)
return;
m_hrishiS = dlg.m_MyString;
UpdateData (FALSE);
}
Now go back to your book, or the MFC manual pages, and look up UpdateData. Also read the code for DoDataExchange that has been created automatically for you, and look up DDX_Text in the manual.
I hope this steers you in the right direction.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
A heartfelt thanks to you
I got it done.
Thanks a lot again.
-----------------------------
I am a beginner
|
|
|
|
|
I am using following imports:
//Mircorsoft Office Objects
#import \
"C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE12\mso.dll"\
rename("DocumentProperties", "DocumentPropertiesXL")\
rename("RGB", "RBGXL")
//Microsoft VBA Objects
#import \
"C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\vbe6ext.olb"
//Excel Application Objects
using namespace Office;
#import "C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE"\
rename("DialogBox", "DialogBoxXL") rename("RGB", "RBGXL")\
rename("DocumentProperties", "DocumentPropertiesXL")\
rename("ReplaceText", "ReplaceTextXL")\
rename("CopyFile", "CopyFileXL")\
exclude("IFont", "IPicture") no_dual_interfaces
Excel::_ApplicationPtr XL;
Excel::_WorkbookPtr book;
Excel::_WorksheetPtr sheet;
By using for loop ,able to get all workbook names.Using following code iterating through item, getting all workbook names.
book = XL->Workbooks->Item[1];
In case of worksheet, i am not getting the name of worksheet.There is no such option as workbook.
Able to point to particular sheet, but name option is not there.
sheet = XL->Workbooks->Item[1]->Sheets->Item[1];
I want to retrieve whole list of worksheets present in workbook.
Googled but I didn't get any clue.
If there is any option, please give me clue.
Thanks in advance.
Gtag.
Hey if any one knows, please give me clue.
modified on Tuesday, September 29, 2009 9:29 AM
|
|
|
|
|
// --- Print worksheet names
Excel::_WorksheetPtr p_sheet;
m_lngWorksheets = m_xLBook->Worksheets->Count;
TRACE("Number of Worksheets is <%d>\n", m_lngWorksheets );
for ( ico=1;ico<=m_lngWorksheets;ico++ )
{
p_sheet = m_xLBook->Worksheets->Item[ico];
_stprintf(p_szBuffer, _T("%s"), (LPCTSTR)p_sheet->Name);
TRACE("Worksheet %d Name is %s\n", ico, p_szBuffer );
}
|
|
|
|
|
On BN_CLICKED, I do:
hCombo = GetDlgItem(hwnd,COMBOBOX_WAVEFORMTYPE);
EnableWindow(hCombo,FALSE)
to attempt to disable my combobox. the odd thing is that it appears disbled since it's grayed out. But, I can still pull down the arrow and see the contents. If I do this on WM_CREATE:
hCombo =
CreateWindow(
"combobox", // Either "edit", "button", "combobox", or "static"
"", // Can be set to ""
CBS_DROPDOWNLIST|CBS_UPPERCASE|WS_CHILD|WS_TABSTOP,
0, 0, 0, 0, // Positioning information
hwnd, // The parent window handle
(HMENU)(COMBOBOX_WAVEFORMTYPE), // The Identifier
hInst, // Global application instance
NULL); // Additional data, not required
SendMessage(hCombo,CB_ADDSTRING,0,(LPARAM)"Square Wave");
SendMessage(hCombo,CB_ADDSTRING,0,(LPARAM)"Triangle Wave");
SendMessage(hCombo,CB_ADDSTRING,0,(LPARAM)"Saw tooth");
EnableWindow(hCombo,FALSE);
It works fine! What is the difference? This problem is killing me. Thanks
|
|
|
|
|
The best way is to add a control variable to your combo box and call m_Combo.EnableWindow(FALSE);
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
It looks a lot like he's using Win32 rather than MFC...
But your point is correct!
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Yes, I am using win32. Is there a way do do it without resorting to MFC? Thanks
|
|
|
|
|
The frame work is not the issue. Rajesh's point is that you should keep the window handle to the created combobox.
Whether you do that with a HWND in Win32, or a CWnd / CComboBox in MFC is not really the issue.
If it is created as part of a dialog, then that's a bit harder.
I'd turn to spy++ and see what is different on the control in the two scenarios you describe.
I really don;t see the problem with:
HWND hCombo = GetDlgItem (hDlg, IDC_MYCOMBO);
if (hCombo) EnableWindow (hCombo, FALSE);
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Thanks for your help. Actually, the problem was pretty stupid. I'm new to win32 programming... I had invoked WM_CREATE on my own, effectively creating 2 instances of each child window. I didn't realize that WM_CREATE was called by the window's manager upon client creation, my bad. Again, thanks for answering my question.
|
|
|
|
|