|
That works but can you explain why?
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
I'm not a guru but I suppose the the compiler interpret (well a compiler does'nt interpret code, but...) :
char *str[] = {"one", "two"};
as
char *str[2] = {"one", "two"};
I think (not shure) that your code might compile in old C but not in C++ (new behaviour).
|
|
|
|
|
I have an dll that write with MC++.How can I import it to my project?When I add #import line in my stdafx.h I got an error that it can't open this library file.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
r u given the path for #import directive?
other wise u can put the dll in your working directory
anju
|
|
|
|
|
|
Would you please give me more details Nish?How can I use it?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Okay here goes :-
- First use tlbexp on your mc++ dll to get the tlb file :-
tlbexp mcpp.dll /out:mcppdll.tlb
- Now register the dll using regasm
- Now simply
#import mcpp.tlb in your unmanaged C++ code and use it just as you'd use a normal COM dll
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Thank you Nish.
Does use it in this way reduce speed or performance in comparision to using unmanaged c++?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
|
Thanks Nish,I found my problem
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
I think I forget my COM skills Nish,I have a problem with it.I register and import them into my project.I have some class in my dll.I can see them in my editor(CTRL+space) but when I compile them it gives me an error that they are undeclare identifier.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
How can i set a new icon in the toolbar of my MFC program at run-time ?
How to link the windows message sent when the user click the new button with a predefined function ?
Thanks !
|
|
|
|
|
I think you could just create the toolbar as normal.
Link the message map handlers as you would normaly.
But then set the state of the button to TBSTATE_HIDDEN with the SetState command.
When you want to *add* it just set the state to Not HIDDEN.
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Ok ! It's an option.
Because I may create a lot of new windows, each of them with its own icon, i could predefined a lot of HIDDEN buttons. When I allocate a new wnd, i change the picture and make the icon active.
I don't know why, I don't like this method so much !
I will use it if there is noway.
Thanks Asim !
|
|
|
|
|
Use CToolbar::SetButtons() and a ON_COMMAND_RANGE handler.
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
The CToolBar::GetToolBarCtrl() method returns CToolBarCtrl control which offers methods to manipulate the toolbar.
Sonork 100.15206;PavelK
|
|
|
|
|
Great, it works ! But... small, small problem.
When i create a new button, the toolbar is not big enough and the last one is no visible anymore. If i move the toolbar to another position in the window, it resize itself automatically and all the buttons become visible again.
I try adding Invalidate() and AutoResize(), but doesn't work. How to get the toolbar with the right width ?
void CMyAppView::OnAddNewModule()
{
CToolBarCtrl* pToolBarCtrl;
pToolBarCtrl = &(((CMainFrame*)GetParentFrame())->GetToolbar())->GetToolBarCtrl();
TBBUTTON tbButton;
tbButton.iBitmap = pToolBarCtrl->AddBitmap(1, IDB_MY_RUNTIME_ID);
tbButton.idCommand = MY_NEW_COMMAND;
tbButton.fsState = TBSTATE_ENABLED;
tbButton.fsStyle = TBSTYLE_BUTTON;
tbButton.dwData = NULL;
tbButton.iString = NULL;
if (tbButton.iBitmap==-1)
TRACE("I couldn't load the button image");
if (!pToolBarCtrl->InsertButton(1, &tbButton))
TRACE("I couldn't create the new button");
pToolBarCtrl->AutoSize();
}
Thanks !
PD: I use ON_COMMAND_RANGE handler, to catch the new event with my predefined ID, thanks Saurwein
|
|
|
|
|
Hello,
I'm not very familiar with all these IE COM interfaces, so it's difficult to me to find out the correct way. All I want to do is capture mouse events in my custom toolbar (e.g. mouse movements or clicks within the view of the html document). Any links & suggestions will be very appreciated.
Best regards
Best regards
/Bart
|
|
|
|
|
I've created my custom true type font and install it manually using normal procedure from control panel fonts folder. After installing, all applications starts loading it normally. But whenever i restart my computer, the font get uninstalled again and i've to refresh the windows fonts folder. Can anyone tell me whats the trouble ???
|
|
|
|
|
You need to add a new REG_SZ key under
Win9x \HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\Fonts
WinNt \HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\Fonts
The key name should be the font name ("My New Font") and the value should be the font filename (myfont.ttf). This is assuming the font has been installed to the %windir%\fonts directory.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
Hi everyone,
I was trying to implement an auto_ptr like smart pointer by myself (as you all know by now, by my numerous questions) I had problems with the casting operator. Many suggested using an implicit cast like
operator T* ()
{
return _p;
}
However, I did not want to use an implicit cast. I know auto_ptr does not use it either. Someone suggested using a member template. However, I have no idea what a member template is. Can someone point me to some information about them? Or if someone has an explanation of how to use them, I would reallay appreciate it.
As always, eternally grateful
Pankaj
Without struggle, there is no progress
|
|
|
|
|
pankajdaga wrote:
However, I have no idea what a member template is.
Well, the name is self exlaining. Member template == template method.
template <class T>
class Ptr
{
public:
Ptr(T* pp = NULL) { p = pp; }
template <class T2>
void Assign(T2 *pp)
{
p = pp;
}
private:
T *p;
};
Ptr<CWnd> pw;
CDialog d;
pw.Assign(&d);
CString s;
pw.Assign(&s);
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
I'm writing a server based on sockets and i want to use asynchronous accept calls. By default they are synchronous.
Do you know how to set them up?
rechi
|
|
|
|
|
Is it possible to create a CMDIFrameWnd with a CSplitterWnd in it? Or is that only done in CFrameWnd and CMDIChildWnd?
Bla bla bla
|
|
|
|
|
Create a new CView derived class named CNewView (for example) and modify OnDraw like this
void CNewView::OnDraw(CDC* pDC)
{
} Now overwrite these two methods:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_split.CreateStatic(GetParentOwner(), 1, 2))
AfxMessageBox("Failure on split creation!");
m_split.CreateView(0, 0, RUNTIME_CLASS(CNewView), CSize(0, 0), pContext);
m_split.CreateView(0, 1, RUNTIME_CLASS(CNewView), CSize(0, 0), pContext);
PostMessage(WM_SIZE);
return CMDIFrameWnd::OnCreateClient(lpcs, pContext);
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIFrameWnd::OnSize(nType, cx, cy);
m_split.SetWindowPos(&wndTop, 50, 50, 100, 100, SWP_SHOWWINDOW);
} where m_split is the CSplitterWnd member.
rechi
|
|
|
|