|
What is line 138?
Have you tried:
ON_MESSAGE(CM_PROGRESS_STEPIT, &CCancelUIThread::OnStepProgress)
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Ummm - a CWinThread is not a CWnd, so it can't have ON_MESSAGE handlers. It *can* have ON_THREAD_MESSAGE handlers, though…so use those instead...
The reason VC6 doesn't complain is that its compiler is so lax at checking and enforcing static typing rules. That's a bad thing, m'kay, 'cause it means there can be many latent, potential bugs left in your code.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Hi All,
I had Extracted a DLL from a CAB file(Installation package) and edited it using VS2005 to translate some captions in String Table from English to French language(for testing my installation package to support other language) and Saved.
Using the above DLL we are re-creating a Translated Kit(Installation package) and installed it in a fresh machine, After successful installation of my software, While trying to access the above mentioned translated DLL, MFC crash occurs.
The same DLL(Compiled and Build using existing source code in VS2005) with all above actions(translating the string table entries)is working fine.
Can anybody tell me what i am missing / anybody faced similar kind of issue?
Note: I had tried accessing other DLLs to translate the string table entries and corresponding DLLs are accessed without any errors.Also The project properties of both the DLLs(Working/Not Working) are similar.
Thanks in advance.
Thirumalesh
Never Never Never Give Up!
|
|
|
|
|
Hi, I want to Automate MS Word 2010 to extract text with the following code. but I get run-time error "A null reference pointer was passed to the stub."
am I doing something wrong?
CString strDocFile(L"C:\\a.doc");
COleVariant covTrue((short)TRUE), covFalse((short)FALSE), covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
CApplication appObj;
if(!appObj.CreateDispatch(L"Word.Application"))
{
AfxMessageBox(L"could Not Create The Application Object");
return;
}
appObj.put_Visible(FALSE);
CDocuments docsObj(appObj.get_Documents());
CDocument0 docObj;
COleVariant oleStrFile(strDocFile.GetString(),VT_BSTR);
LPDISPATCH pIDoc = docsObj.Open(
oleStrFile,
covFalse,
covFalse,
covFalse,
covOptional,
covOptional,
covFalse,
covOptional,
covOptional,
covOptional,
covOptional,
covTrue,
covOptional,
(long)0,
covOptional,
covFalse
);
docObj.AttachDispatch(pIDoc);
docObj.Activate();
docObj.Select();
CSelection selObj(appObj.get_Selection());
CString docText = selObj.get_Text();
docObj.Close(covOptional, covOptional, covOptional);
docsObj.Close(covOptional, covOptional, covOptional);
appObj.Quit(covOptional, covOptional, covOptional);
modified on Friday, July 9, 2010 8:48 AM
|
|
|
|
|
Is part of the quiz guessing on what line the error occurs?
My guess is that the file L"C:\a.doc" does not exist, and Open fails which sends a null reference to AttachDispatch.
Have you tried opening the file named L"C:\\a.doc" instead?
You don't seem to like checking on return values much.
|
|
|
|
|
Of course I miss type that in the forum, in my program i retreve the filename from CFileDialog.
I ame sure of file path and file existance.
|
|
|
|
|
So what about checking return values?
|
|
|
|
|
Of course I did , I just simplify the code for the forum, the open method of CDocuments throw the exception and I use the following method instead of Open and It works correctly but again I don't know why the previous one doesn’t work.
LPDISPATCH pIDoc = docsObj.Open2000(
oleStrFile,
covFalse,
covFalse,
covFalse,
covOptional,
covOptional,
covFalse,
covOptional,
covOptional,
covOptional,
covOptional,
covTrue
);
|
|
|
|
|
From what I can find[^]
this
covOptional,
(long)0,
covOptional,
covFalse
should be this
covOptional,
covOptional,
(long)0,
covOptional,
|
|
|
|
|
Of course what you mentioned is related to older versions of office type libraries
What i used is Microsoft Word 14.0 Object Library <8.5> which has diffrent interface for Open Method, and OpenConflictDocument parameter is not supported.
But there are other alternative open methods that implement older parameters, Like:
docsObj.OpenOld(...)
docsObj.Open2000(...)
docsObj.Open2002(...)
the last one is what you mentioned but it result in error too.
Only the Open2000(...) method work with out problem but it doesnot support docx documents.
|
|
|
|
|
Hi,
I am tring to pass a structure from one process to another process via file mapping (shared memory).
I am able to get all varibales but unable to get the pointer value defined in dirrerent process.
I think memory addresses are relative to local to that process...How can I access same memory in diffrent process.
|
|
|
|
|
You are correct that addresses are only valid in the context of its process. You would have to put that data into shared memory as well.
|
|
|
|
|
|
Have a look at Ash's reply on serializing data below.
|
|
|
|
|
Creating shared memory is the right way, so different processes and communicate in a secure way.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
You have to work out how you're going to marshal (as in railway marshalling, not US law enforcement officer) your data from one process to another.
Generally you have an intermediate form that you write into your shared memory and then read out again in the other process. Say you have a class:
class A
{
public:
std::string text_;
};
You can't just use something like placement new, copy it into the shared memory and expect it to work. The string's characters could be anywhere in the source address space. One solution is to treat the shared memory like a file - you can write the characters and how many of them there are into the shared memory and read them out on the other side:
class A
{
public:
std::string text_;
void raw_memory_write( void *where );
void raw_memory_read( void *where );
};
Once you've implemented this pair you have to work out how to signal the other process that there's an object to read AND, if you want bidirectional comms, avoid writing to the same memory (you can use two blocks for this, one for each process to write into and the other to read from). While there are ways of doing this if you don't know what you're doing it can backfire horribly.
An alternative to using shared memory is to use an interprocess comms mechanism that's already out there and works. For example sockets if it has to be portable. That way all you have to worry about is reading/writing a stream of bytes from something that looks surprisingly like a file. And it's less code to write a simple sockets client/server pair than manage all the detritus around shared memory.
Cheers,
Ash
|
|
|
|
|
In my project I use many dialogbars allowing it to be docked and undocked.
I need to change the dialogbars size according to some runtime conditions and it works but,
when I dock or undock the dialog bar it restores the initial size or, when I dock another bar close to the resized bar, it consider the initial size and not the new one.
Does someone one know how to let dialogbar resize operation work properly ?
Thanks a lot !
|
|
|
|
|
How to add check mark in front of selected item in listbox in MFC..
Can anyone help me how to do this..
Thanks..
|
|
|
|
|
use
CCheckListBox .
I hope it will help you.
|
|
|
|
|
No sir, CCheckListbox will show the check box in front of every item, but I want to put check mark only in the front of selected item, rest of the items shoud not hv check box.
|
|
|
|
|
If it's your owner drawn list box with the hover effect, you can just paint the check mark in your DrawItem() method. Otherwise I'm afraid you will have to create yet another owner drawn list box class.
|
|
|
|
|
ya its my ownerdraw list box.. but I don't know how t oremove rest of check boxes on paint.
Could u please send me some sample code or some more hnt how to do..
Thanks..
|
|
|
|
|
I would probably try to derive my class from a non-checkbox control to avoid all checkboxes in the first place. Then, paint a check box and maintain the checked state myself.
Are you going to use the checkbox as a selection indicator only, or does it have any other purpose?
|
|
|
|
|
it doesn't hv any purpose. the only thing is that it make difference between the item which is already selected and the item which have the focus. I mean If "A" is already selected and my mouse is on "B" then "A" shoud hv check mark and "B " hv background color in back.
|
|
|
|
|
Well, then just paint a check mark (or whatever icon you'd like) in the beginning of the row if the item is selected.
Edit: Another way of dealing with this is to use the font and change it to be underlined when hovered. That way the selection problem goes away.
|
|
|
|