|
rajaasif wrote: please can anybody send code:
Oh no, not again!!! i am seeing this line pretty often these days..
vijay.
|
|
|
|
|
I am getting the runtime error: "Debug Assertion Failed" from mfc71d.dll when try to create application class object in another file.
MyApp.h<br />
class CMyApp : public CWinApp<br />
{<br />
public:<br />
---<br />
HRESULT GetCommonDevice(LPDIRECT3DDEVICE9& m_pd3dDevice_REF);<br />
---<br />
}<br />
<br />
<br />
MyWnd.h<br />
#include "MyApp.h"<br />
class CMyWnd : public CWnd<br />
{<br />
DECLARE_DYNAMIC(CMyWnd)<br />
public:<br />
CMyWnd();<br />
void init();<br />
---<br />
}<br />
<br />
MyWnd.cpp<br />
---<br />
void CMyWnd::init()<br />
{<br />
CMyApp c;<br />
HRESULT hr = c.GetCommonDevice(m_pD3dDevice); <-- Here the debug assertion at run time<br />
---<br />
}<br />
}
Any help would be greatly appreciated!
Thanks & Regards,
Suman
|
|
|
|
|
Use like this
HRESULT hr = (afxGetApp())->GetCommonDevice(m_pD3dDevice);
rather than
CMyApp c;
HRESULT hr = c.GetCommonDevice(m_pD3dDevice);
nirmal
|
|
|
|
|
if u want to acess CWinApp use AfxGetApp() .Each application that uses the Microsoft Foundation classes can only contain one object derived from CWinApp
never say die
|
|
|
|
|
rp_suman wrote: CMyApp c;
HRESULT hr = c.GetCommonDevice(m_pD3dDevice); <-- Here the debug assertion at run time
What are you doing ?
Application object is available globally.
You can use AfxGetApp() to access it.
|
|
|
|
|
Thanks for help.
I have tried using AfxGetApp() already but the App classe's functions are not listed by intellisense but only MFC's CWinApp class functions are listed. I am debugging the problem.
Thanks & Regards,
Suman
|
|
|
|
|
You need to use type casting.
i.e. your function would like this,
void CMyWnd::init()
{
HRESULT hr = ((CMyApp*)AfxGetApp())->GetCommonDevice(m_pD3dDevice);
}
|
|
|
|
|
Thank you very much for great help!
Thanks & Regards,
Suman
|
|
|
|
|
When We restart Windows, the C:\Windows\System32 opens automatically.How to stop the above operation.is there any registry settings available?
|
|
|
|
|
IMO, the most likely cause for this behaviour is that some program is (supposed to be) autostarted, but the start command contains a space character. And the command string isn't surrounded by quotes.
An example:
C:\Windows\System32\some program
This doesn't work, Windows doesn't find the program "C:\Windows\System32\some", so it opens an explorer window (showing the contents of C:\Windows\System32) instead.
The solution is to surrond the command with quotes, i.e.
"C:\Windows\System32\some program"
Now, it will work.
The problem is to find the registry setting containing the malformed command. Start searching for "C:\Windows\System32" (without the quotes) in the registry.
Then surround that command with quotes.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Kakan,
I will try and tell the result
Thanks,
|
|
|
|
|
kakan wrote: The solution is to surrond the command with quotes, i.e.
"C:\Windows\System32\some program"
Now, it will work.
(No offence, just joking)
There is a good chance that the program is a virus . Once he finishes doing the settings, there's going to be a lot of fun
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
That's right, it might be a virus or malware.
But he won't have to see an explorer window when he logs in, though.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
kakan wrote: he won't have to see an explorer window when he logs in, though.
In that case, well he may not see windows explorer at every start up :-> But the sad thing is that he may neither see explorer nor desktop or any icons, even after startup
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
And the virus is likely to be very dangerous since the developer is causing things to happen that are not intended to happen.
|
|
|
|
|
Hi all,
I need to get the selected text in the running application. As we get the copied data from the clipboard.I want to use this in Outlook addin where it will return the selected text from the mail.Is there any provision for MailItem object in Outlook Automation?
Thanks in Advance.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
Mahesh KulkarniI need to get the selected text in the running application. As we get the copied data from the clipboard.I want to use this in Outlook addin where it will return the selected text from the mail.Is there any provision for MailItem object in Outlook Automation?
I'm not understanding your requirement. Be more precise and just explain what your problem is. Do not give an detailed explanation of your project (unless required)
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
I want selected text from Outlook MailItem.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
If MS Word is the editor there, then you can write it in VBA. I'm not sure, but there'd be something like selection.gettext
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Is there any difference between the following two commands?
sprintf(oOrder.ContractName , "%s\0", ContTick.ContractName);
strcpy(oOrder.ContractName, ContTick.ContractName);
Both operands are defined as
typedef CHAR ConNameStr[11];
|
|
|
|
|
Oliver123 wrote: Is there any difference between the following two commands?
No
Not in the result, anyway.
|
|
|
|
|
Mark is correct. However, sprintf is used for copying the string with formatting, and strcopy is used purely for string copying. If you are just copying a string, why use sprintf with its apparent overhead. It also has more of a chance to cause a buffer overrun.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Oliver123 wrote: sprintf(oOrder.ContractName , "%s\0", ContTick.ContractName);
To add to previous replies. Here, you dont need to append NULL character , it will taken care by sprintf .
|
|
|
|
|
The results will be almost the same, save for the fact that the sprintf(...) example will place two NUL characters at the end of the string.
The sprintf(...) function is designed to build a formatted string using a variable list of parameters, and it can do this formatting in many different ways. As a result, its implementation is somewhat complex, and it may take longer to run than a call to strcpy(...) in this simple case.
The strcpy(...) function is designed to copy strings. As such, its implementation is much simpler, and it may execute faster than sprintf(...) .
Both functions have the potential to overrun the target buffer, because they (as shown) will not limit the data copied to the buffer. Using a function like strncpy(...) allows you to enforce the amount of data copied to the target buffer, but you may have to watch out for a missing terminating NUL character in some cases.
Not that you asked, but I would suggest using strcpy(...)/strncpy(...) for copying strings - that is what they were designed to do and what they are generally optimized for. IMHO, using functions like printf(...)/sprintf(...) for static/constant strings indicates either a lack of understanding or a unconscious need to use a shotgun to kill a fly!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
James R. Twine wrote: ...save for the fact that the sprintf(...) example will place two NUL characters at the end of the string.
FYI - Not true
Beer. It's not just for breakfast anymore!
|
|
|
|