|
Do you need to get this information at runtime? I think getting names of variables is impossible at runtime!
ARSALAN MALIK
|
|
|
|
|
Yes!
I thought some like :
Dim ctl As Control
For Each ctl In Me.Controls
MsgBox ctl.Name
Next
.
In Access Dialog it'is possible, so I was hoping that in VC++ would be possible too.
Filippo
|
|
|
|
|
Can I ask you why you need this ?
There is probably another solution for your problem (like for example, getting all the Id's of the controls ans working with that...)
|
|
|
|
|
I would like to "standardize" a procedure that make easy to display in different dialogs a certain number of values.
I have i.e. two (indipendent) Database tables, one containing first and last name and age (first_name,last_name, age), the other containing i.e company names and adresses (company_name,company_address).
In my App i have two dialog boxes containing each two EditBoxes with CString m_first_name, CString m_last_name, int m_age in the first one , and CString m_company_name and CString m_company_address in the second one.
I could write for every control its assigning value instructions, but what happen if my dialogs have ten's of EBoxes?
With a loop looking like:
CString elemName= "";
for (long i=0; i <mydlg.controlcount(); i++)="" {
="" mydlg.controlname(i)="" -=""> m_first_name
elemName.Format(Mid(myDlg.ControlName(i),2,99)); // first_name
switch (myDlg.ControlType(i)){
case dbText: // write in i.e. m_first_name the value of first_name
myDlg.ControlName(i).SetValueAsString(elemName);
break;
case dbInt: // i.e. Age
myDlg.ControlName(i).SetValueAsInt(elemName);
break;
etc...
}
}
Does it look somehow clear?
Filippo
|
|
|
|
|
You can also use the SetWindowText function in this way:
GetDlgItem(Id)->SetWindowText("Blah");
What you can do is something lije that: retrieve the number of fields you need to create and then create dynamically (for example) an edit box per field (and you specify an ID different for each of them). Then you can retrieve the values of your fields and use SetWindowText to print it in the edit box...
But this is just a suggestion...
Hope this helps
|
|
|
|
|
From the VB sample you are talking about, it is possible when using an activeX control, since the control supports a property "Name"
I am not disturbing your question, this is just for information. If someone can correct me with more info on what i said, I would appreciate that
Thanks
-------------------------
Have a great day ahead!
Regards,
Sohail Kadiwala
modified 21-Apr-21 21:01pm.
|
|
|
|
|
you can use GetDlgCtrlID() to get the id (i.e. IDC_TEXT1), but other than that the variables you associate with your control (i.e. m_txtName) aren't part of the control, just mapped to it using DDX. If you really need to know the name of a control at runtime, I think the best way would be to make a class derived from the class you want (class CMyEdit : public CEdit) and add Get/Set functions for name as a string or just make a public member variable called m_strName.
[insert witty comment here]
bdiamond
|
|
|
|
|
|
Hello,
you are right. I remember reading the variable names are resolved to their respective addresses during compilation.
I could be wrong though.
|
|
|
|
|
Hi,
I create a combo dynamically like this. I want to get a vertical scroll bar, but I don't how. Can anybody help me out.
CComboBox m_SchemaCombo;
m_SchemaCombo.Create(WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP |
CBS_DROPDOWNLIST,
CRect(row3,
frameTop + 3 * topBottomOffset + buttonHeight3,
editBoxWidth,
frameTop + 3 * topBottomOffset + buttonHeight2 + buttonHeight2 + buttonHeight2),
this, IDC_SCHEMA_COMBO);
Thanks,
Prahsant
|
|
|
|
|
Hi,
Im starting a project to make a low resource constantly running screen recrder for windows. It will output a medium quality video in a common format. I was just wondering if anyone has any ideas on how to start this. I have never seen any source code for anything similiar to this. Any help or advice with the following would be great
1) How to turn a series of jpegs into a movie?
2) How to record directly to video using DivX compression.
3) The best language to use C# or C++
I have found many plugins and small programs that do the job of compression but I intend to write everything from scratch, many thanks.
|
|
|
|
|
what is the problem? fetch the screenshot using GDI, extract the raw data of the bitmap and pass it to the video compressor. what is so difficult about this?
Don't try it, just do it!
|
|
|
|
|
How can we control the Z Order of controls on a Dialog?
kriaz.
|
|
|
|
|
SetWindowPos(...)
ARSALAN MALIK
|
|
|
|
|
If you only need to do this at design time then use the tab order (Ctrl+D) in the resource editor. Tab order 1..n when 1 is furthest away and 'n' is nearest i.e. n will be on top of 1.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hi All,
I am creating crystal reports(version 8.5) using VC++ code.
Its working fine on the the machines which have crystal reports installed .
however same is not the case with non crystal machines even after registring the Crystl32.OCX used by the Crystal Reports Object.
Do I need to do some thing in addition to this ?
kindly help.
thx
Sanjay
|
|
|
|
|
Do you have run time crystal dll's installed? I mean to say, you have to deploy some dll's with which you can view the reports. (view-only)
|
|
|
|
|
I am getting error " Unable to logon to server" while trying to run the report.
DSNs are same on both type of machines.
(one with crystal reports and one without it )
I have already distributed these dlls with the application.
(Crystl32.OCX,Craxdrt.dll, CRViewer.dll,CRDesignerCtrl.dll,Craxddrt.dll)
Is there anything db specific which needs to be distributed ?
thanks
Sanjay
|
|
|
|
|
Hi all,
Is there any way to hide an exe file , which was run from my code by the shell_execute command ?
Is there any other command that I can use in order to run an exe file from my code in hide mode ?
|
|
|
|
|
What do you want to hide, application window, taskbar icon or process from task manager?
ARSALAN MALIK
|
|
|
|
|
I want to hide an app window , which I trigger from my code
|
|
|
|
|
You can use WinExec(...) , with second parameter SW_HIDE .
ARSALAN MALIK
|
|
|
|
|
That'll only work if the writer of the app used the nCmdShow parameter passed to WinMain for displaying the window...
If the programmer didn't use the nCmdShow parameter, you should send a WM_SHOW message to the window with some parameter set to FALSE (I think it was wParam, but I'm not sure ).
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Hey all,
Had a brief search but couldn't find anything.
VC++ 6.
Ok, I have a class, which contains a CString declaration:
CString sString;
In the constuctor of the class, I set the sString = "";
I also provide Set and Get functions as inline functions in the header file. These are not being called at the moment.
I try to write the value out to the database, expecting the sString to be equal to "" (for the time being at least) and its got some rogue value in it, e.g. "Test". All the other CStrings in this class are also being see to "Test". (These other CStrings are being used in exactly the same way).
I have noticed that the pch address are all the same. Is this correct? Have I made a mistake? Any ideas?
Cheers
Jock
|
|
|
|
|
You definitely have something wrong. It sounds like you might be corrupting the heap.
CString will be initialized to an empty string so there is no need to assigh "" to it, not that this is relevant.
I'd trace it through in the Debugger keeping an eye on sString et.all.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|