|
Hello,
I want to start a vector of calsses with the same contruct
Lets say this is my class :
<br />
class aaa<br />
{<br />
public:<br />
aaa(int i){ m_iA = i; }<br />
private:<br />
int m_iA;<br />
};<br />
and I want now to do 5 classes with the same contruct:
<br />
aaa* f = aaa(2)[5];<br />
I have to do a loop for this (pointer of pointers etc.) ?
Or it is possible to do this somehow in a short way ?
Thanks,
|
|
|
|
|
Ohad Cabiri wrote: I have to do a loop for this (pointer of pointers etc.) ?
In fact if you don't have a default constructor, the only way to do that is to have an array of pointers to your class:
aaa** pArray;
...
...
pArray = new aaa*[5];
And then loop through your array and create all the classes:
for (int i=0;i<5;i++)
pArray[i] = new aaa(Value);
Of course, you will need to delete all these instances AND the array.
|
|
|
|
|
So there is no shortcut here.
Thanks
|
|
|
|
|
If a statically-allocated array is acceptable, you can do:
aaa stuff[] = { aaa(2), aaa(2), aaa(2), aaa(2), aaa(2) };
|
|
|
|
|
Hi,
I am using IADS component to query about the user information from a local machine.
Sometimes, When i call ADsGetObject method, it takes more time to query about the user. But some times it happens quick.
I am querying about an user who is created in the local machine.
What is the reason for this? How can i solve this problem.
Any help would be very much appreciated.
Thanks.
Selva
|
|
|
|
|
Hi,
I want to write some application that looking some file name ( "file.exe" or *.exe ) on the entire disk.
Can some one help me ?
|
|
|
|
|
Some please can help me with this one ?
|
|
|
|
|
Hi,
There are two APIs for searching a folder
FindFirstFile & FindNextFile
or there is an MFC Class CFileFind, which is almost like a wrapper to above mentioned APIs. you can go through the documents of these APIs.
bye
P.Somasundaram
|
|
|
|
|
|
You can use of FindFirstFile/FindNextFile I was working with them it easy if you declare their on a thread is good.
|
|
|
|
|
can any body help me??
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
i'm trying to convert this c++ code into vb 6.0 can i?, any recommendation for the message sending function i should use in vb?
thx
|
|
|
|
|
having problems with "unbolded" text ??
moreover, if you needed help on VB specific, you'd better ask the VB forum (unless you have a specific C/C++ question ?)...
|
|
|
|
|
That's a mighty BOLD question for a C++ forum
|
|
|
|
|
Hi !!!
I am initialize text and retriving it on dialog box..My code is like..
CDialog::OnInitDialog();
m_ExchListbox.AddString(_T("Exchanger-Double end"));
m_ExchListbox.AddString(_T("Exchanger-Single end"));
m_ExchListbox.AddString(_T("Exchanger-Double end kettle"));
m_ExchListbox.AddString(_T("Exchanger-Single end kettle"));
m_ExchListbox.AddString(_T("Exchanger-Super"));
m_ExchListbox.AddString(_T("Exchanger-Process Flow"));
m_ExchListbox.SetCurSel(0);
n out put of the dialog box is not same as what i declred..ie the out put is like..
Exchanger-Double end
Exchanger-Double end kettle
Exchanger-Process Flow
Exchanger-Super
Exchanger-Single end
Exchanger-Single end kettle
ie i want out put as same as i declred.. ie first should be Exchanger-Double end and last should be Exchanger-Process Flow..I dont want alphabetically character out put..
Thanking you
Shah Satish
Shah Satish
|
|
|
|
|
In the dialog editor, right-click on your listbox and search in the settings. There should be an option to sort the list. Uncheck the check box 'Sort'.
|
|
|
|
|
|
Mr satish,
I already told you that when you have to post code, you have to use the <pre></pre> tags around your pieces of code !
please edit your message consequently
ps: edit means reuse the same message and modifying it, without reposting a new message (have you noticed the little [Modify] link at the bottom of your post ?).
as we are on a forum, it also implies that you share with us on the boards, instead of mailing me your modifications...
|
|
|
|
|
Sorry dear..I forgot it..
Shah
|
|
|
|
|
ListBox and ComboBox has a option on the property window that is sort you can set it to true or false
|
|
|
|
|
Good day to you all!
I created an application having a spin control(vertical scrollbar) attached to an edit box. I needed the application to increment/decrement by 0.01 everytime the scrollbar is pressed. Later on I found out that the default increment is set to 1. What should I do so that the increment would be set to 0.01 and also the display in the edit box having two decimal places?
Thank you very much for the help and time!
|
|
|
|
|
Huh?
I've never seen a spin control or scrollbar implementation that used floating point.
Why not set the range to range*100 and anytime you display the position use position/100 ?
Mark
|
|
|
|
|
Yes that was what I was planning to do. I just wanted to confirm if there was a possibility of using float/double inside the spin control.
Thank you for the help!
|
|
|
|
|
Hello,
I have developed a Channel File that is distributed using an installation file. In order to install the File on the active desktop I use a small C++ application which does the following:
ShellExecute(NULL, NULL, activedesktop.cdf, "", "", SW_NORMAL);
When I tested on several machines on some XP it works just fine and on other it does not show the Add Item to Active Desktop dialog.
If someone has experience with the Active Desktop I would appreciate a suggestion.
Thanks, Dan.
|
|
|
|
|
Hello,
I have managed to find the solution. For anyone interested this is it:
bool InstallActiveDesktop()<br />
{<br />
COMPONENT component;<br />
COMPPOS comppos;<br />
CoInitialize(NULL);<br />
HRESULT hr;<br />
IActiveDesktop *pActiveDesktop;<br />
hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,<br />
IID_IActiveDesktop, (void**)&pActiveDesktop);<br />
ZeroMemory(&component, sizeof(COMPONENT));<br />
component.dwSize = sizeof(COMPONENT);<br />
component.iComponentType = COMP_TYPE_WEBSITE;<br />
component.fChecked = TRUE;<br />
component.fDirty = TRUE;<br />
component.fNoScroll = TRUE;<br />
comppos.dwHeight = 400;<br />
comppos.dwSize = sizeof(COMPPOS);<br />
comppos.dwWidth = 165;<br />
comppos.fCanResize = TRUE;<br />
comppos.fCanResizeX = TRUE;<br />
comppos.fCanResizeY = TRUE;<br />
comppos.iLeft = 400;<br />
comppos.iTop = 20;<br />
comppos.izIndex = 0;<br />
component.cpPos = comppos;<br />
MultiByteToWideChar(CP_ACP, 0, "FriendlyName",<br />
strlen("FriendlyName")+1, <br />
component.wszFriendlyName, sizeof(component.wszFriendlyName));<br />
MultiByteToWideChar(CP_ACP, 0, "http://www.complete.link",<br />
strlen("http://www.complete.link")+1, <br />
component.wszSource, sizeof(component.wszFriendlyName));<br />
component.dwCurItemState = IS_NORMAL;<br />
pActiveDesktop->AddDesktopItem(&component, 0);<br />
pActiveDesktop->ApplyChanges(AD_APPLY_ALL);<br />
pActiveDesktop->Release();<br />
CoUninitialize();<br />
return true; <br />
}<br />
bool UnInstallActiveDesktop()<br />
{<br />
COMPONENT component;<br />
COMPPOS comppos;<br />
CoInitialize(NULL);<br />
HRESULT hr;<br />
IActiveDesktop *pActiveDesktop;<br />
hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,<br />
IID_IActiveDesktop, (void**)&pActiveDesktop);<br />
ZeroMemory(&component, sizeof(COMPONENT));<br />
component.dwSize = sizeof(COMPONENT);<br />
component.iComponentType = COMP_TYPE_WEBSITE;<br />
component.fChecked = TRUE;<br />
component.fDirty = TRUE;<br />
component.fNoScroll = TRUE;<br />
comppos.dwHeight = 400;<br />
comppos.dwSize = sizeof(COMPPOS);<br />
comppos.dwWidth = 165;<br />
comppos.fCanResize = TRUE;<br />
comppos.fCanResizeX = TRUE;<br />
comppos.fCanResizeY = TRUE;<br />
comppos.iLeft = 100;<br />
comppos.iTop = 20;<br />
comppos.izIndex = 0;<br />
component.cpPos = comppos;<br />
MultiByteToWideChar(CP_ACP, 0, "FriendlyName",<br />
strlen("FriendlyName")+1, <br />
component.wszFriendlyName, sizeof(component.wszFriendlyName));<br />
MultiByteToWideChar(CP_ACP, 0, "http://www.complete.link",<br />
strlen("http://www.complete.link")+1, <br />
component.wszSource, sizeof(component.wszFriendlyName));<br />
component.dwCurItemState = IS_NORMAL;<br />
pActiveDesktop->RemoveDesktopItem(&component, 0);<br />
pActiveDesktop->ApplyChanges(AD_APPLY_ALL);<br />
pActiveDesktop->Release();<br />
CoUninitialize();<br />
return true; <br />
}
|
|
|
|
|
Hi to All,
I m writing a code to send mail from my smtp server to othres. for this purpose i want to aunthenticate my smtp server with username and password.
Please tell me how can i authenticate my server.
i m trying like this.
User = "sulabh" ;
nUser = Encode(user); // base64 encoding
Pwd = "123456";
nPwd = Encode(Pwd);
CString str;
str.Format("%s""%s""%s""%s", NULL, nUser, NULL, nPwd);//Is it right Format???
Nstr = Encode(str);
sHello.Format( "EHLO %s\r\n", local_host );
m_wsSMTPServer.Send( (LPCTSTR)sHello, sHello.GetLength() ); /////////WORK FINE
nHello.Format( "AUTH %s\r\n", Nstr );
m_wsSMTPServer.Send( (LPCTSTR)nHello, nHello.GetLength() ); ///// ///RETURN AUTHENTICATION FAILED
Please tell me the right way to do this
Thanks in Adavace
|
|
|
|