|
it would be helpful if you say how such a operation is restricted with arrays. but it can be used with single object. is it the difficulty for compiler in writing same code for more than one object? or any oothr purposeful use for that?
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
Honestly, I have no idea why the compiler doesn't support initializing arrays of classes during construction, but according to MSDN that's just the way it is. Perhaps there's some sort of breach of the standard or a problem with the syntax. I don't know.
I don't know what's your use of this is, but maybe it will be easier for you to use an array of pointers instead of a pointer to an array. Then you can allocate and initialize each element in a loop instead.
Cheers
Steen.
"Are you gonna check your makeup when you're done whining?" John Simmons, 05/31/2006
|
|
|
|
|
This is what I just wrote on VC7.0.
#include <iostream>
class MyClass {
public:
MyClass(int a){}
MyClass(){}
};
int main() {
MyClass* p1 = new MyClass(6);
MyClass* p2 = new MyClass[6];
}
This works just fine.
-- modified at 6:50 Tuesday 15th August, 2006
Abhishek
|
|
|
|
|
The following will do what you want.
class MyClass
{
public:
MyClass(int a) : m_MyInt(a) { }
MyClass() : m_MyInt(0) { }
void SetInt(int a) { m_MyInt = a; }
private:
int m_MyInt;
};
int main()
{
MyClass* pClass1 = new MyClass(6);
MyClass* pClass2 = new MyClass[5];
for (int i = 0; i < 5; ++i)
{
pClass2[i].SetInt(i);
}
delete pClass1;
delete [] pClass2;
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Does VS2005 supprts GDI+ ???
|
|
|
|
|
Why do you think it wouldn't?
Kevin
|
|
|
|
|
Do you have error with GDI+ in vs2005?
|
|
|
|
|
hi !
I am trying to execute debug build of my project which is bieng ported from VC6 to VC8. The problem i am facing is, everytime I try to run .exe file it gives me error saying :
MSVCR80.Dll was not found!
I googled and found this is the problem with many others. But I am still not getting a solution for the same. I found it has something to do with manifest file. I found there were two manifest files as
---appllication.exe.embeded.manifest
---appllication.exe.intermidiate.manifest both of these files have same contents and refering to new MFC8.
Also I found that MSVCR70.dll has been installed properly and it is at location
D:\WINDOWS\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_f75eb16c
Everything seems to be ok!! Can anybody plz help me regarding solving the problem!!
Thx in advance!!
|
|
|
|
|
From what I can think of, you need to copy MSVCR80.Dll in your local\application directory. That should sove the problem.
-- modified at 7:02 Wednesday 9th August, 2006
Abhishek
|
|
|
|
|
Hi!
I tried the same. I copied the file to .windows/system32 directory. But then it says :
R6034: Application has made an attemp to load C runtime library incorrectly.....
Also. when i googled. I found its not a right solution for the problem. p
plz help!
|
|
|
|
|
It's because Microsoft introduced manifest files in Visual studio 2005 (they were already there in 2003 but were not mandatory). This was done to avoid the dll hell problems.
There is an article here [^]that explains that in detail (I didn't read it completely but it seems to be very good).
Hope this helps
|
|
|
|
|
Great link. Brilliant article.
Abhishek
|
|
|
|
|
I gone through the article.
But I still couldnt solved the problem.
Can somebody help me plz!!
Also Its written there in article that MS is going to release SP1 for VS2005. Do u know when it will be released??
Thx!
|
|
|
|
|
Firstly, don’t place any application specific DLLs in System32. Place them in the folder that contains your executable. It helps avoiding DLL hell!
Secondly, try this article:
http://blog.kalmbachnet.de/?postid=80
I don’t have VS 2005 on my system. So I can't reproduce your problem. But you'll have to look at some more options.
Abhishek
|
|
|
|
|
Hi all
I have created a tooltip for a button.
How to show this tooltip from the application?? ie I need to Show the ToolTip Message for the button from my application code.
thanks
Manjunath S
Bangalore
|
|
|
|
|
call the RelayEvent function of tool tip from the PreTranslateMessage function. The tootip will popup when the u move mouse over that button.
nave
|
|
|
|
|
Hi, thanks
In my case Tooltip will popup when mouse moves over the button, but i need to popup the tip text from my application (by hard coding)by sending some messages.
I tried SendMessage with POPUP flag, but i am not getting(SendMessage returning NULL).
Manjunath S
Bangalore
|
|
|
|
|
|
See
<br />
m_tooltip.Create(this);<br />
SetToolTip("ADAD");<br />
<pre><br />
void CAnswerView::SetToolTip(LPTSTR ToolTip)<br />
{<br />
TOOLINFO ti;<br />
ti.cbSize = sizeof(TOOLINFO);<br />
ti.lpszText = ToolTip;<br />
ti.hinst = AfxGetInstanceHandle();<br />
ti.hwnd = m_Button.m_hWnd;<br />
<br />
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;<br />
ti.uId = (UINT) m_Button.m_hWnd;<br />
m_tooltip.SendMessage(TTM_ADDTOOL, 0, (LPARAM) &ti);<br />
}<br />
|
|
|
|
|
I don't know what I hae done, but my app no longer supports input from the IME (Input Method Editor). When I try to change the input language using the hotkeys (CTRL + SHIFT) nothing happens, the input language does not change. When I try to select the language from the Task bar, my app loses focus and still the language does not change. The IME works for other programs, just not my own. I have no idea where to even start looking for the cause of the problem. Any help would be greatly appreciated.
|
|
|
|
|
You shold change key lang with ALT + SHIFT no CTRL + SHIFT .
|
|
|
|
|
Well thankyou so much for that useful unsight into the correct keys. But, you are slightly wrong. Users, such as myself, are able to change the key combination. Here in China, the preferred is to use the SHIFT + CTRL.
As a follow up to my problem, it is now fixed. I do not know what was the cause. I started commenting function calls hoping to narrow it down a little, after uncommenting the problem vanished. Please note, no code was changed.
|
|
|
|
|
Hi
I have an MDI application.I want to remove the default menu bars and toolbar provided and place a customized toolbar instead.So I removed
the added menu bar code and toolbar code from CMainframe::Oncreate().
When I executed the application the toolbar is removed but the menu bar of childframe still exists.
I tried placing setmenu(NULL ) in childframes OnCreate but no use.
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
return -1;
//(CChildFrame *)(GetParentFrame( ))->SetMenu (NULL);
this->SetMenu (NULL);
this->ShowWindow (SW_SHOWMAXIMIZED);
return 0;
}
Can anybody please tell me what more i can do?
Thanx
Today is a gift, that's why it is called the present
-- modified at 5:31 Wednesday 9th August, 2006
|
|
|
|
|
|
Hi,
I want to invoke a Remote Desktop connection Programmatically. It should take 3 Parameters:ComputerName,UserName and Password for Logon, then I should be able to run a ".exe" in the Remote Machine to which i Logged on.
Please Help me. I had tired using the API:WNetAddConnection2, Here is the Piece of Code which i tried.
NETRESOURCE nr;
DWORD res;
TCHAR szUserName[32] = "administrator",
szPassword[32] = "admin123",
szLocalName[32] = "Z:",
szRemoteName[MAX_PATH] = "\\\\deepa";
nr.dwType = RESOURCETYPE_ANY;
nr.lpLocalName = szLocalName;
nr.lpRemoteName = szRemoteName;
nr.lpProvider = NULL;
res = WNetAddConnection2(&nr, szPassword, szUserName, FALSE);
DWORD err=GetLastError();
I have added the link file mpr.lib under Project->Setting->Link.
I am getting the Following Error:1203
Thanks in Advance,
Deepa
|
|
|
|