|
Hi,
can you show me how to process NM_CLICK message with sample, this is my idea too but dont know how to do this
Do you mean this message that is from the msdn:
<br />
lResult = SendMessage(
(HWND) hWndControl,
(UINT) WM_NOTIFY,
(WPARAM) wParam,
(LPARAM) lParam
); <br />
regards
termal
|
|
|
|
|
Yes, WM_NOTIFY/NM_CLICK is sent when the tab selection is changed. You can set a function to pick it up by adding
ON_NOTIFY(NM_CLICK, <tab control="" id="">, <function name="">)
to the message map.
Where your function is defined as -
void <class>::<function name="">(NMHDR* pNMHdr, LRESULT* pResult)
|
|
|
|
|
termal wrote: m_cTabAll.SetCurSel(0);
That's the one that will work. I've used it in my code successfully. However, I don't think it will fire your TCN_SELCHANGE handler - you'll need to do that yourself.
The structure I've used in the past is something like this:
MyDlg::OnTabChangedHandler(arguments)
{
ChangeTab(tab.GetCurSel());
}
void MyDlg::ChangeTab(int tab)
{
Do stuff
tab.SetCurSel(tab);
}
MyDlg::SomeButtonClickedHandler()
{
ChangeTab(0);
}
so - move the 'on tab changed' actions to a separate routine that you can call from other places.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I suppose you must be creating dialogs on each of the tab pages to place your controls.
If that is the case then use the following code to programatically switch to a tab page: ( else just let me know more details. )
void CMyDialog::ShowPage( int nPage )
{
//you need to hide the current dialog.
m_dlgArray[m_tabCurrent]->ShowWindow(SW_HIDE);
//switch the tab.
m_cTabAll.SetCurFocus(nPage);
m_cTabAll.SetCurSel(nPage);
//show the new dialog.
m_dlgArray[nPage]->ShowWindow(SW_SHOW);
m_dlgArray[nPage]->SetFocus();
}
|
|
|
|
|
|
SHBrowseForFolder Function may help you...
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
For lack of a better response, your question really makes no sense. If you want to access a file in the current directory, use ".\\somefile" notation. If you want to access a file in the parent directory, use "..\\somefile" notation. If you want to access a file in a subdirectory of the current directory, use ".\\subdir\\somefile" notation.
If that's not what you're after, blame it on my lack of understanding your request.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi All
How can i check path is exits or not in system(pc)?plz give me Api or function name?
Thanks is advance
|
|
|
|
|
|
i got solution from msdn.
(_access(path,0)==0)
|
|
|
|
|
Hello Davitor,
You can use function - PathFileExists()[^].
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
You can use of FindFirstFile.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Also look at GetFileAttributes() (Which I used just yesterday!)
(One problem with FileExists() is that it returns true for both files and directories.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
hi every one
I create a static library with visual c++ 6.0 App wizard.
I create a new generic class and declared my variables in its header file.
Then I initialized my variables in class constructor.
I want to use it in a new dialog based project, so I add related header file and write my library name in linker tab at project setting.
I create one object of this class in my function, But at the end of function when application exits from function occurs an exception.
I can't handle this exception.
Note : when I comment initialized this exception don’t happen.
Please help me
////////////////////////////////////////////////////////////////
// static library class (Test.h)
///////////////////////////////////////////////////////////////
class CTest
{
public:
CTest();
virtual ~CTest();
int m_i1;
int m_i2;
bool m_b1;
bool m_b2;
unsigned int m_ui1;
unsigned int m_ui2;
unsigned short m_us1;
unsigned short m_us2;
BYTE m_bte1;
BYTE m_bte2;
CString m_str1;
CString m_str2;
};</afx.h></windef.h>
#include "stdafx.h"
#include "Test.h"
CTest::CTest()
{
m_i1=0;
m_i2=0;
m_b1=true;
m_b2=true;
m_ui1=0;
m_ui2=0;
m_us1=1;
m_us2=1;
m_bte1=0;
m_bte2=0;
m_str1="";
m_str2="";
}
CTest::~CTest()
{
}
////////////////////////////////////////////////////////////////
// My dialog base application
///////////////////////////////////////////////////////////////
void CUseTestLibDlg::OnBinitlib()
{
CTest *pcTest=new CTest();
delete pcTest;
pcTest=NULL;
}
void CUseTestLibDlg::OnBinitlib2()
{
CTest pcTest;
}
modified on Wednesday, April 29, 2009 6:26 AM
|
|
|
|
|
samira forooghi wrote: pcTest=NULL;
delete pcTest;
I would invert the order of the statements...
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]
|
|
|
|
|
thanks for u
i correct it ,but its not my problem.
|
|
|
|
|
Looks like good advice...
Steve
|
|
|
|
|
Shouldn't cause an accvio, though - you can delete NULL in C++.
|
|
|
|
|
but will result in a memory leak.
This signature was proudly tested on animals.
|
|
|
|
|
I didn't say it wouldn't - I was just saying that fixing it wouldn't solve the OP's problem.
|
|
|
|
|
|
Yes, but Carlo just indicated one of flaws in the OP's code. I agree that it wouldn't solve 'the problem' of the OP, but it might (hopefully) prevent the OP from shooting his own face sometime in the future.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
i havent any problem with new delete , occur exception even this case
void CUseTestLibDlg::OnBinitlib2()
{
CTest pcTest;
}
|
|
|
|
|
The problem's obviously in CTest's destructor. The only significant activity in CTest's destructor will be calls to m_str1's and m_str2's destructors. Therefore, the access violation is happening somewhere in there.
I suspect there's something not quite right with your project settings - check that the library and main app are using hte same MFC and C run-time library settings.
|
|
|
|
|
I have just started at a new job. Here we are new to using JNI ( for bridging C++ / Java ). I am new to JNI so please forgive my noobness
In our (win32) Java app we are loading a C++ DLL. On the Java side we have several instances of "SomeJClass" each of these instances needs access to corresponding instance of "SomeCClass" on the DLL side. The DLL exposes entry-points such as GlobalDoSomethingInC(). Here I must call the instance method of Doer::DoSomethingInC(). So I need a smooth way to map the respective this-pointers. I also need to do the same mapping when a DLL thread discovers something interesting that it needs to notify the corresponding Java-instance of.
I can think of several solutions, but I do not like them too much. My question is, is there a better way than this ?
1 Java calls C:GetNewInstance(). This returns an int that is actually a pointer to the new C instance. Java stores it in m_myCInstance. Then Java calls GlobalDoSomethingInC(), and 1a
void GlobalDoSomethingInC()<br />
{<br />
jobj tmpJ = NewGlobalRef( env, obj );<br />
Doer* myDoer = <reinterpret_cast>( Doer )tmpJ->GetMyCInstance();<br />
myDoer->DoSomething();<br />
DeleteGlobalRef( env, tmpJ );<br />
}<br />
</reinterpret_cast>
1b or:
Doer* myDoer = <reinterpret_cast>( Doer )instanceParam->DoSomethingInC();<br />
<br />
</reinterpret_cast> 2 For calling from C to Java, things look, maybe, better
In the constructor C calls back into Java and stores
the Java instance reference
in a member variable. m_myJInstance.<br />
In all subsequent calls m_myJInstance can be used to call back Java.<br />
In the destructor we need to call DeleteGlobalRef( env, m_myJInstance );<br />
Not too bad I suppose. But it really safe to store the jobject reference. I mean: What happens when the GC moves the object around?
3 Our present solution does "work". But it belongs on rather on http://www.codinghorror.com/blog/
Another question, for JNI experts only. How much juice does it cost to do this sequence:
<br />
jobj tmpJ = NewGlobalRef( env, obj );<br />
tmpJ->GetMyCInstance();<br />
DeleteGlobalRef( env, tmpJ );
Thanks
Adam
........................
Life is too shor
|
|
|
|