|
Hmm, thanks, but isn't it 'if' statement implemented in asm?
I wanted to know if the virtual functions table initialization tradeof is high or not.
thanks anyway,
Guy.
|
|
|
|
|
diamond inheritance is a problem when you have virtual methods; the derived class doesn't know which base class method to call.
about efficency, don't create a new class for nothing, a simple inline method will be enough, let the compiler do the job.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi!
i have got a Pointer to a window and want to get its toolbar.can anybody help me how to get toolbar from Window object.
|
|
|
|
|
One way is to use EnumChildWindows() and in the EnumChildProc() check the Window Style or Class to see if it is the Toolbar.
Another way is to use FindWindowEx() and specify the Toolbar class name.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Hi All,
I’m currently having trouble with inconsistent behavior some Win32 API BegingUpdateResource, UpdateResource and EndUpdateResource usage; which are used to manipulate resources in Win32 Binaries, below is a fuller description of the problem, could someone please help.
Development environment:
VC++, with Visual Studio .Net 2002, on Win2k (Service Pack 4)
Test environments:
WinXP, Win2K, WinNT
Problem description:
The assignment is in the translation domain, which requires updating resources in the Win32 binaries with translated text (in a language different from the original binary). In-order to achieve this we use the following Win32API: (FindResourceEx, LoadResource, LockResource …e.t.c to achieve this.)
Additionally this requires us to change the language ID of the resources contained, as there is no apparent method that would directly allow this, we chose the following approach:
We delete necessary resources using the API: (BeginUpdateResource, UpdateResource with NULL buffer and 0 size and EndUpdateResource)
And then update the
Following is a description of the issues/problems that I’ve encountered:
On deleting a single resource from a Win32Binary, I’ve observed that “sometimes” all resources are deleted (which reduces a source exe of 9MB, to 98KB destination exe).
This is typically the case for very large binary files, however, this is not very predictable, it seems to work fine on some boxes and not so well on some others, we are yet to conclude on the commonalities among the problem causing environments.
Below is a snippet of the code that I use to do this, could someone please help in pr
Code Snippet:
//Deleting resource(English):-
HANDLE hUpdateRes =
BeginUpdateResource((LPCWSTR)m_strDestFilePath.GetBuffer(), FALSE);
BOOL flgResultInt1 = FALSE;
long lBlockId = 100;
flgResultInt1 = UpdateResource(hUpdateRes, 0x05, MAKEINTRESOURCE(lBlockId), 1033, NULL, 0 );
BOOL flgRes = FALSE;
flgRes = EndUpdateResource(hUpdateRes, FALSE);
//Updating resource(Japanese):-
HANDLE hUpdateRes =
BeginUpdateResource((LPCWSTR)m_strDestFilePath.GetBuffer(), FALSE);
BOOL flgResultInt1 = FALSE;
long lBlockId = 100;
flgResultInt1 = UpdateResource(hUpdateRes, 0x05, MAKEINTRESOURCE(lBlockId), 1041, (LPVOID)buff, sizeof(buff) );
BOOL flgRes = FALSE;
flgRes = EndUpdateResource(hUpdateRes, FALSE);
Maharaj.M
|
|
|
|
|
MaharajM wrote:
BeginUpdateResource((LPCWSTR)m_strDestFilePath.GetBuffer(), FALSE);
...
BeginUpdateResource((LPCWSTR)m_strDestFilePath.GetBuffer(), FALSE);
Unless you are modifying the contents of m_strDestFilePath , the calls to GetBuffer() are unnecessary, and could potentially cause problems.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
i would like to know how to send midi data to the usb using windows midi driver???i have already sent this midi data to the midi sw synth(default of window midi player),how can i route it to the usb driver???i am not supposed to make my own driver but use the already existing windows drivers!!!!!.....
please help.....
|
|
|
|
|
Hello..
How do i import a third party libary (.lib) in Visual C++ .NET. I keep on getting the LNK2019 error during linking. I already added an entry on
Project->Properties->Linker->Advanced->Import Library = $Path\MyLib.lib..
I know this is pretty much the way to add libraries in VC++ 6...
But I still get the same error....
|
|
|
|
|
Ok.. sorry for this post.. I got this to work already.. I was supposed to insert the .lib file on the ... LInker->Input parameter...
sorry for the dumb question...
|
|
|
|
|
How to make a program that is similar to Sysmantic AntiVirus ,namely a windows service with a tray icon can pop a main window.if you know ,please tell me more.thanks a lot !
|
|
|
|
|
|
Hi,Everyone:
i create a project CFormView as its base class. i add "List Control" in the Mainform, and i use the "List Control" with code below:
-----------------------------------------------------------------------
class CvcydcjView : public CFormView
void CvcydcjView::OnInitialUpdate()
{
...
CListCtrl* pList = (CListCtrl*) GetDlgItem( IDC_LIST_MEM);
pList->InsertColumn(0, "TestColumn", LVCFMT_CENTER,40);
...
}
-----------------------------------------------------------------------
now i want to use the control in my other class, obviously i can't use that code to get the DlgItem, can anyone help me to solve the problem? -- use the Mainform Control in other class.
Thank you so much!
- - - - - - - - - - - - - - - - - - - - - - - - - -
Many nights we prayed with no proof anyone could hear, we were moving moutains long before we knew we could !
Yet now i'm standing here, although we know there's much to fear, hope seems like summer bird too swiftly flown away ...
There can be miracles! When you believe, though hope is frail, it's hard to kill !
Who knows what miracles, you can achieve! When you believe, somehow you will ...
YOU WILL WHEN YOU BELIEVE
|
|
|
|
|
First Obtain the ptr of view class "CvcydcjView"
as
CMainFrame* pMainFrmWnd = (CMainFrame*)AfxGetMainWnd();<br />
ASSERT(pMainFrmWnd != NULL);<br />
CvcydcjView* pYourView = NULL;<br />
CWnd* pchildWnd = pMainFrmWnd->GetWindow(GW_CHILD);<br />
ASSERT(pchildWnd->GetSafeHwnd() != NULL);<br />
while(childWnd->GetSafeHwnd() != NULL)<br />
{<br />
ASSERT(childWnd->GetSafeHwnd() != NULL);<br />
if(childWnd->GetRuntimeClass()->m_lpszClassName == "CvcydcjView")<br />
{<br />
pYourView = (CvcydcjView*)childWnd;<br />
break;<br />
}<br />
childWnd = childWnd->GetWindow(GW_HWNDNEXT);<br />
}<br />
ASSERT(pYourView != NULL);
Now you have got ptr to your class you can call the functions as
CListCtrl* pList = (CListCtrl*)pYourView->GetDlgItem( IDC_LIST_MEM);<br />
pList->InsertColumn(0, "TestColumn", LVCFMT_CENTER,40);
At the moment i dont remember whether GetDlgItem() is public or not.
If its not public create your own function that should be public which calls GetDlgItem inside the class as
The below is the public function
CWnd* CvcydcjView::getItem(UINT p_nResourceID)<br />
{<br />
return GetDlgItem(p_nResourceID);<br />
}
now call this function form your other class as
CListCtrl* pList = (CListCtrl*)pYourView->getItem( IDC_LIST_MEM);<br />
pList->InsertColumn(0, "TestColumn", LVCFMT_CENTER,40);
..RR..
|
|
|
|
|
Hi,Dear Rahim:
first of all, thank you so much for your reply!
as you said:
Rahim Rattani wrote:
CMainFrame* pMainFrmWnd = (CMainFrame*)AfxGetMainWnd();
but i get these errors:
-------------------------------------
error C2065: 'CMainFrame' : undeclared identifier
....
and in my project i don't have CMainFrame Class cos it's Form based
Do you have any other suggestions?
Thx a million! (it's really lots of informations you provide!)
- - - - - - - - - - - - - - - - - - - - - - - - - -
Many nights we prayed with no proof anyone could hear, we were moving moutains long before we knew we could !
Yet now i'm standing here, although we know there's much to fear, hope seems like summer bird too swiftly flown away ...
There can be miracles! When you believe, though hope is frail, it's hard to kill !
Who knows what miracles, you can achieve! When you believe, somehow you will ...
YOU WILL WHEN YOU BELIEVE
|
|
|
|
|
If you are workin on a dialog based application, the dialog is declared and created in InitInstance() of the Application class.
Why dont u declare the dlg as public in the class, instead of InitInstance().
Create and display it in InitInstance but declare it as a public variable.
Then you will be able to accessit anywhere as theApp.yourDlgVariable;
..RR..
|
|
|
|
|
Rahim Rattani wrote:
dialog based application
it's a bit different.
i created the project using single document and last step choose form-base, so i do have CvcydcjApp class as well as CvcydcjDoc & CvcydcjView.
i don't know whether your method can be used in this case and how ? could you tell me the details.
Thx a million!
Best wishes!
- - - - - - - - - - - - - - - - - - - - - - - - - -
Many nights we prayed with no proof anyone could hear, we were moving moutains long before we knew we could !
Yet now i'm standing here, although we know there's much to fear, hope seems like summer bird too swiftly flown away ...
There can be miracles! When you believe, though hope is frail, it's hard to kill !
Who knows what miracles, you can achieve! When you believe, somehow you will ...
YOU WILL WHEN YOU BELIEVE
|
|
|
|
|
If you are using a SDI application, then you ould definitely have a CMainframe class (the one i mentioned in my first reply).
CMainfrmae is the class derived from CFrameWnd, and without it u can cannot create a SDI application.
Check it you will have a CMainFrame class in your application and let me know.
The solution in my first reply should definitely work.
Let me know if you have a class name CMainframe (or a class derived from CFrameWnd)
..RR..
|
|
|
|
|
i'm so sorry! i do have CMainframe Class!
i'm so stupid! sorry!
i'll try your first method!
Thx a million!!!!
- - - - - - - - - - - - - - - - - - - - - - - - - -
Many nights we prayed with no proof anyone could hear, we were moving moutains long before we knew we could !
Yet now i'm standing here, although we know there's much to fear, hope seems like summer bird too swiftly flown away ...
There can be miracles! When you believe, though hope is frail, it's hard to kill !
Who knows what miracles, you can achieve! When you believe, somehow you will ...
YOU WILL WHEN YOU BELIEVE
|
|
|
|
|
MessageBox("Put the code in the right way! :)")
Thx!
- - - - - - - - - - - - - - - - - - - - - - - - - -
Many nights we prayed with no proof anyone could hear, we were moving moutains long before we knew we could !
Yet now i'm standing here, although we know there's much to fear, hope seems like summer bird too swiftly flown away ...
There can be miracles! When you believe, though hope is frail, it's hard to kill !
Who knows what miracles, you can achieve! When you believe, somehow you will ...
YOU WILL WHEN YOU BELIEVE
|
|
|
|
|
You're my hero!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ^.^
Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
it worked!!!!!!!!!!!!!!!!! ^.^
God Bless you!!!!!!!
- - - - - - - - - - - - - - - - - - - - - - - - - -
Many nights we prayed with no proof anyone could hear, we were moving moutains long before we knew we could !
Yet now i'm standing here, although we know there's much to fear, hope seems like summer bird too swiftly flown away ...
There can be miracles! When you believe, though hope is frail, it's hard to kill !
Who knows what miracles, you can achieve! When you believe, somehow you will ...
YOU WILL WHEN YOU BELIEVE
|
|
|
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - -
Many nights we prayed with no proof anyone could hear, we were moving moutains long before we knew we could !
Yet now i'm standing here, although we know there's much to fear, hope seems like summer bird too swiftly flown away ...
There can be miracles! When you believe, though hope is frail, it's hard to kill !
Who knows what miracles, you can achieve! When you believe, somehow you will ...
YOU WILL WHEN YOU BELIEVE
|
|
|
|
|
Hi,Rahim:
Your code run very well in my class, thx!
now i met some problem when it's running in a thread,
<br />
DWORD WINAPI CallOut(LPVOID lp)<br />
{<br />
...<br />
CMainFrame* pMainFrmWnd = (CMainFrame*)AfxGetMainWnd();<br />
ASSERT(pMainFrmWnd != NULL);<br />
CvcydcjView* pYourView = NULL;<br />
CWnd* pchildWnd = pMainFrmWnd->GetWindow(GW_CHILD);<br />
ASSERT(pchildWnd->GetSafeHwnd() != NULL);<br />
while(pchildWnd->GetSafeHwnd() != NULL)<br />
{<br />
ASSERT(pchildWnd->GetSafeHwnd() != NULL);<br />
if(pchildWnd->GetRuntimeClass()->m_lpszClassName == "CvcydcjView")<br />
{<br />
pYourView = (CvcydcjView*)pchildWnd;<br />
break;<br />
}<br />
pchildWnd = pchildWnd->GetWindow(GW_HWNDNEXT);<br />
}<br />
ASSERT(pYourView != NULL);<br />
}<br />
when i debug, the program stopped at:
<br />
while(pchildWnd->GetSafeHwnd() != NULL);<br />
i create the thread using following code:
<br />
m_hCallthread = CreateThread(<br />
NULL,
NULL,
CallOut,
NULL,
0,
NULL
);<br />
can u give me some suggestions? Thx!
- - - - - - - - - - - - - - - - - - - - - - - - - -
Many nights we prayed with no proof anyone could hear, we were moving moutains long before we knew we could !
Yet now i'm standing here, although we know there's much to fear, hope seems like summer bird too swiftly flown away ...
There can be miracles! When you believe, though hope is frail, it's hard to kill !
Who knows what miracles, you can achieve! When you believe, somehow you will ...
YOU WILL WHEN YOU BELIEVE
|
|
|
|
|
What were the values in PMainFrmWnd and pChildWnd when the program broke up.
Also tell me the how many times the while loop had processed when this problem came.
Was it a ASSERTION or an unhandled exception.
Also paste the stack trace.
Rahim Rattani
Software Engineer,
Matrix Systems (Pvt) Ltd.,
Karachi - Pakistan
|
|
|
|
|
Rahim Rattani wrote:
PMainFrmWnd
:0x00461300
at first is 0x00462d90
Rahim Rattani wrote:
pChildWnd when the program broke up.
is 0x00000000
Rahim Rattani wrote:
how many times the while loop had processed when this problem came
: it's 2
Rahim Rattani wrote:
Was it a ASSERTION or an unhandled exception.
yes, it's
<br />
ASSERT(pYourView != NULL);<br />
the programme can't run into
<br />
pYourView = (CvcydcjView*)pchildWnd;<br />
Rahim Rattani wrote:
stack trace.
i'm so sorry i don't know how to get it...
Thank you soooooooooooo much!
- - - - - - - - - - - - - - - - - - - - - - - - - -
Many nights we prayed with no proof anyone could hear, we were moving moutains long before we knew we could !
Yet now i'm standing here, although we know there's much to fear, hope seems like summer bird too swiftly flown away ...
There can be miracles! When you believe, though hope is frail, it's hard to kill !
Who knows what miracles, you can achieve! When you believe, somehow you will ...
YOU WILL WHEN YOU BELIEVE
|
|
|
|
|
I dont have a clue whats the problem. But still I woudl suggest that instead of obtaning a pointer to the view in a thread and working on it. You should obtain a pointer to it before initiating the thread and pass it to the thread as a parameter. I will consider it as a much better option.
Rahim Rattani
Software Engineer,
Matrix Systems (Pvt) Ltd.,
Karachi - Pakistan
|
|
|
|
|