|
|
|
Why don't you provide more information to people that replied to your posts insted of posting it again and again?
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]
|
|
|
|
|
CPallini wrote: Why don't you provide more information to people
Why do you want to help me? Is this my problem or you?
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 )
|
|
|
|
|
Hamid. wrote: Why do you want to help me?
'Coz I'm bad boy, sir!
Hamid. wrote: Is this my problem or you?
I am your problem...
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]
|
|
|
|
|
What drugz are you guys on?
|
|
|
|
|
How can I distinguish?...I'm on drugz, you know...
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]
|
|
|
|
|
CPallini wrote: I am your problem...
oh yeah that's right I could to find problem!
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 )
|
|
|
|
|
I have created a COM object which implements IDispatch so I can call it from scripting languages.
In the constructor, I'm trying to get the path to the App Data folder and store it in a member variable. I know that this is failing and I'm trying (unsuccessfully) to debug.
Until testing is complete, my object has a method which exposes the HRESULT from the last function call to the scripting language as a string.
[id(10), helpstring("Get last function's HRESULT.")] HRESULT GetHRESULT( [out, retval] BSTR * bsHRES); This function returns the value of another member variable, BSTR m_HR , which I set using m_HR = OLESTR("Some Text") before returning from any member function.
As part of the constructor debugging process, I am trying to set the BSTR m_HR to the path of the App Data folder:
TCHAR * tcPath = new TCHAR;
HRESULT hres = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, tcPath);
if ( FAILED(hres) ) {
m_HR = OLESTR("SHGetFolderPath failed.");
} else {
_bstr_t bst = _bstr_t(tcPath);
m_HR = bst.copy();
};
delete tcPath;
return;
<p><font size=-2>
</font> I double checked the SHGetFolderPath bit from a console application and tcPath contains the path desired.
When I use m_HR = OLESTR("Some Text") , calling GetHRESULT returns "Some Text" properly. With this constructor, however, successive object creations (and calls to GetHRESULT ) return, alternately, "Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\" and NULL. (That's not the App Data path.)
I've been banging my head on this for a couple days now - I'd be grateful for any help ya'll can offer.
MZR
P.S.
My apologies for the non-compilable code, but just the complete constructor is 70ish lines, plus the MIDL file, and the header file.... if you think you can help and need to see the complete code to do so, let me know and I'll happily email you the complete source.
|
|
|
|
|
You say nothing about how bsHRES is set in your method (or am I wrong?).
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 taking a look, Pallini.
You're completely right. My apologies - here's the GetHRESULT(...) method definition. (I'm never sure how much code to post, though, in hindsight, this is an important bit.)
HRESULT Man::GetHRESULT(BSTR *bsHRES) {
if ( bsHRES == NULL ) {
m_HR = OLESTR("ERROR_INVALID_PARAMETER");
return ERROR_INVALID_PARAMETER;
};
*bsHRES = m_HR;
m_HR = OLESTR("S_OK");
return S_OK;
};
|
|
|
|
|
You should use
*bsHRES = SysAllocString( m_HR );
I suppose.
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]
|
|
|
|
|
Believe it or not, I HAD considered that - I wasn't sure if I needed a call to SysAllocString there or not.. Adding it had no effect, though.
Thanks again for taking a look, though, Pallini. I'll find it eventually...
|
|
|
|
|
Mike the Red wrote: Believe it or not, I HAD considered that
I find no diffuculty to believe that.
Mike the Red wrote: I wasn't sure if I needed a call to SysAllocString there or not..
You should use it.
Mike the Red wrote: Adding it had no effect, though.
So there is a problem in another piece of your code. Good luck.
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]
|
|
|
|
|
Mike the Red wrote: TCHAR * tcPath = new TCHAR;
You're allocating one (ONE) character to hold the path - that probably won't be enough Try allocating tcPath like this:
TCHAR * tcPath = new TCHAR[MAX_PATH];
and deallocating it like this:
delete[] tcPath;
or even just declare it on the stack like this:
TCHAR tcPath[MAX_PATH];
and then you don't need to deallocate it....
Mike the Red wrote: m_HR = OLESTR("SHGetFolderPath failed.");
Yeah, that's bad, m'kay? You should create BSTRs with SysAllocString[^]:
m_HR = ::SysAllocString(OLESTR("SHGetFolderPath failed."));
BSTRs aren't just a null-terminated string of OLECHARs.
Mike the Red wrote: m_HR = bst.copy();
You could just use m_HR = bst.Detach(); and reduce the number of string copies you do.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
After many, many rebuilds and relocating return; statements, I finally found the problem..
Some bad code... too embarassingly bad to post... was copying bad data to m_HR and returning before execution even reached the SHGetFolderPath bit...
I thank you both for your help.
MZR
|
|
|
|
|
|
You're kidding, right?
That is a solution, containing two projects (a client and a server), so two different applications (each application has, of course, its own entry point).
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]
|
|
|
|
|
How to read the mac address of machine connected with the switch port?
|
|
|
|
|
Do you want the mac address of a remote machine?
To get the mac address of the local computer you can use GetAdaptersInfo or GetAdaptersAddresses .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hello,
I'm developing an MFC application - an outlook style splitter window app that displays various CFormViews in its right pane.
Recently, I changed the initial view (The AFX_IDW_PANE_FIRST view) to have an icon style CListCtrl, from a report style CListCtrl. The CListCtrl is populated in OnInitialUpdate. This was not the first view in this app to have an icon CListCtrl, so I imagined it wouldn't present any trouble. It doesn't present any trouble with the debug build. However, on the release build, no icons are initially visible in the CReportCtrl's icon style CListCtrl. I have to press a toolbar button that sends a message to the view, whose handler calls the same reloading utility function called from within OnInitialUpdate to have it populated. Then, it behaves correctly.
Why is my CFormView failing to be populated from within OnInitialUpdate? Control flow does reach OnInitialUpdate/the reloading utility function, so it really ought to work, but it doesn't.
Any help that can be offered is of course greatly appreciated,
Regards,
Sternocera
|
|
|
|
|
I have come up with what seems like a reasonable enough work around - rather than calling that utility function directly, I PostMessage(ID_RELOAD ) and have it populated that way.
Regards,
Sternocera
|
|
|
|
|
Hi to all.
When I run my application and start to work with it, after a while it crashes!
Call stack:
00000000()
AfxCallWndProc(CWnd * 0x003af188 {CWnd hWnd=0x00020ae4}, HWND__ * 0x00020ae4, unsigned int 0x00000363, unsigned int 0x00000001, long 0x00000000) line 215 + 26 bytes
CWnd::SendMessageToDescendants(HWND__ * 0x00020ac6, unsigned int 0x00000363, unsigned int 0x00000001, long 0x00000000, int 0x00000001, int 0x00000001) line 2309
CWnd::SendMessageToDescendants(HWND__ * 0x00020ac8, unsigned int 0x00000363, unsigned int 0x00000001, long 0x00000000, int 0x00000001, int 0x00000001) line 2320
CWnd::SendMessageToDescendants(HWND__ * 0x000d09fc, unsigned int 0x00000363, unsigned int 0x00000001, long 0x00000000, int 0x00000001, int 0x00000001) line 2320
CWnd::SendMessageToDescendants(HWND__ * 0x0008099e, unsigned int 0x00000363, unsigned int 0x00000001, long 0x00000000, int 0x00000001, int 0x00000001) line 2320
CWnd::SendMessageToDescendants(unsigned int 0x00000363, unsigned int 0x00000001, long 0x00000000, int 0x00000001, int 0x00000001) line 146 + 32 bytes
CServisiApp::OnIdle(long 0x00000000) line 3694
CWinThread::Run() line 472 + 30 bytes
CWinApp::Run() line 400
AfxWinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00151f0b, int 0x00000001) line 49 + 11 bytes
WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00151f0b, int 0x00000001) line 30
WinMainCRTStartup() line 330 + 54 bytes
KERNEL32! 7c817077()
The error I get is: "First-chance exception in MyApp.exe: 0xC0000005: Access Violation."
Any clue?
Win XP, VC 6
Thanks!
|
|
|
|
|
You should have realized that this is the right time to add some log/traces/Messageboxes at places where you "expect"(blind guess-depends on how much steps in your application have executed already) your application to crash. Also read about the first chance exception handling mechanism here[^] and here[^]
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
I'm aware of this.
The thing is there's no pattern when my app will crash, some times on this occasion and on second run on that. No relationship between?! That's what bugging me!
|
|
|
|
|