|
That is only one way of importing a COM definition.
You can also use the progid or libid:
<br />
#import "libid:0B482F67-46DD-4b1a-BD7C-204444F452E0" named_guids<br />
#import "progid:SomeCOMLibrary.MyCOM.1" named_guids<br />
Using the import directive in this way will ensure path independence from your client program.
I Dream of Absolute Zero
|
|
|
|
|
//onaccept i do like this
CUserSocket *usersocket;
usersocket=new CUserSocket(this);
if(Accept(*usersocket))
{
m_usersocketlist.AddTail(usersocket);
}
//I delete all the usersockets
POSITION pos;
pos=m_usersocketlist.GetHeadPosition();
while(pos!=NULL)
{
CUserSocket* pa;
pa=(CUserSocket*)m_usersocketlist.GetNext(pos);//save pointer
delete pa;//accert here
}
m_usersocketlist.RemoveAll();
when i delete pa
it give an accert in dbgheap.c Expression:_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
how can i delete a socket and free the memeory
-- modified at 9:20 Monday 19th September, 2005
|
|
|
|
|
Hello,
I need to print files using MS Word automation and MFC. I use the PrintOut method available in the application object and it prints perfectly fine. But i'm not finding any method of printing files to a particular tray of the printer.
Code for the same is attached
******************************************************************************
Word::_ApplicationPtr m_pWord;
Word::_DocumentPtr m_pDoc;
/* ms-word print api */
m_pWord->ActiveDocument->PrintOut(covFalse, // Background.
covOptional, COleVariant((long)4), // Range.
covOptional, // OutputFileName.
covOptional, // From.
covOptional, // To.
covOptional, // Item.
COleVariant((long)1), // Copies.
COleVariant(PageRange ,VT_BSTR), // Pages.
covOptional, // PageType.
covOptional, // PrintToFile.
covOptional, // Collate.
covOptional, // ActivePrinterMacGX.
covOptional, // ManualDuplexPrint.
covOptional, // PrintZoomColumn New with Word 2002
covOptional, // PrintZoomRow ditto
covOptional, // PrintZoomPaperWidth ditto
covOptional
);
******************************************************************************
For tray selection am using the following methods, but the desired results are not being achieved. The mentioned method is placed before PrintOut function is called.
******************************************************************************
m_pWord->Options->DefaultTrayID = Word::wdPrinterLowerBin;
******************************************************************************
Thanks for any help provided
Vikram Attiganal
|
|
|
|
|
Hi All,
My application has strings hard-coded in code. To Provide multi-language support in my application, i need to make these strings as a part of resource in the project.
If anybody knows any tool that will move these hard-coded strings to the Resource and write the code at those places to load them from the resource whenever needed, please tell me where to get tool or if u have it, send me at abhijeet23@gmail.com
Thanks in Advance..
Abhijeet Jadhav
|
|
|
|
|
I don't know of a tool to extract the string ( and put them in a text file ) , and replace them with SIGNIFICANT ids; you'd better take a few hours doing it manually.
as for the second part, you need to create a resource DLL ( see here [^] ) and load the DLL depending on the current user language.
and in your code, use CString::LoadString( UINT id ); to load the string from the resources.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi All,
My application has strings hard-coded in code. To Provide multi-language support in my application, i need to make these strings as a part of resource in the project.
If anybody knows any tool that will move these hard-coded strings to the Resource and load them from resource whenever needed, please tell me where to get tool or if u have it, send me at abhijeet23@gmail.com
Thanks in Advance..
Abhijeet Jadhav
|
|
|
|
|
Hi,
When you disable the titlebar (and thus the minimize-button) in a dialog, the application wont minimize anymore on a taskbar click.
I was wondering if you can recreate that behaviour, so that the application minimizes even without a titlebar.
I tried already using an own WndProc-Method to catch the messages of the taskbar to look for a WM_LBUTTONUP or DOWN to minimize and restore the application myself, but the GWL_WNDPROC of SetWindowLong seems to only work for windows of the own process, so that didnt work...
Has anybody got an idea or maybe done that himself already?
thanks alot!
|
|
|
|
|
I hope this is what you're looking for. I've used ShowWindow(SW_MINIMIZE) to minimize my application. (Alternatively, ShowWindow(SW_MAXIMIZE)) Or you might want to check out CWnd::SetWindowPlacement().
Hope this helps!
Danny
|
|
|
|
|
Hi Danny,
This is the way to minimize the window, but my problem remains... I need to know when to call ShowWindow(SW_MINIMIZE) and RESTORE, so when someone clicks on the button in the taskbar i need a way to catch that clicking.
Minimizing my application itself isn't the problem, but getting it on that taskbar click is
thanks for answering though!
|
|
|
|
|
Ah, I see. Sorry, I don't know about what you're looking for. Are you working with an SDI, MDI, or Dialog app? If a dialog, are you opposed to putting your own minimize button on the dialog. If SDI or MDI, can you put an entry in a menu or toolbar? Admittedly, this isn't as good of a solution as being able to do the common taskbar click, but as far as handling WM_LBUTTONDOWN messages, I think that only works within your own app, unless you don't release the mouse if it's clicked outside your app I suppose, (by overriding the WM_CAPTURECHANGE message?)
Or... why do you want the title bar gone? Just so the user can't move the window around? You can remove the user's ability to do this.
Danny
|
|
|
|
|
It's a Dialog and the reason for not having a normal titlebar with minimize-button (and thus the normal taskbar behaviour) is, that my boss wants a customized titlebar.
The Dialog has a button for minimizing and that works as planned, but it would be nice if the application would still behave like any other dialog does (so minimize when clicking on the button in the taskbar).
I can get a handle to the taskbar itself, but i dont know how to be able to hook on its messaging system to be able to react to those WM_... mouseactions myself.
i got the idea with SetWindowLong from this article: http://www.pocketpcdn.com/articles/close_app.html , but for GWL_WNDPROC under NT/2k/XP MSDN says: "You cannot change this attribute if the window does not belong to the same process as the calling thread."
-- modified at 10:21 Monday 19th September, 2005
|
|
|
|
|
Hi there!
I'm devolping an communication program, and sometimes I need to do some sleep's. The problem is that I use some external components that use the PostMessage API, and while the app is sleeping, the messages aren't dispatched..
I've developed a funcion with the folowing code:
void DispatchMsg()<br />
{<br />
MSG msg;<br />
DWORD dwi=GetTickCount();<br />
while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE))<br />
{<br />
::TranslateMessage(&msg);<br />
::DispatchMessage(&msg);<br />
if ((GetTickCount()-dwi)>2000)
break;<br />
}<br />
}
But it seems that some time I get some repeated messages... I've also tried replacing the PM_NOREMOVE by PM_REMOVE parameter in the PeekMessage, but some times the app seems to hang...
Do you have any ideias?
Thanks all for your time.
ALMC
|
|
|
|
|
See MsgWaitForMultipleObjectsEx in MSDN.
"tous les sifflets des trains, toutes les sirènes des bateaux
m'ont chanté cent fois la chanson de l'Eldorado"
rechi+
|
|
|
|
|
How should I use it? Create a foo mutex or event?
I have a main wnd for the app, and a second wnd to receive messages from the comunication component.
I need to call the component api, wait some time so it can send messages to my wnd, and then process them...
ALMC
|
|
|
|
|
Do you want to freeze the window for a while, waiting for the api to throw a message to the queue?
"tous les sifflets des trains, toutes les sirènes des bateaux
m'ont chanté cent fois la chanson de l'Eldorado"
rechi+
|
|
|
|
|
That can be an option!
How do I use the API you've mentioned?
|
|
|
|
|
almc wrote:
How do I use the API you've mentioned?
No, sorry. I was thinking about your component's API
I don't know what your code is about but if you need to freeze the window - or just a part of it - then you might filter all the messages except those coming from the component and a timer which, when appropriate, signals the timeout as the moment of unblocking. If no freezing is required then you should do nothing, just pump the messages as usual.
Something like this...
"tous les sifflets des trains, toutes les sirènes des bateaux
m'ont chanté cent fois la chanson de l'Eldorado"
rechi+
|
|
|
|
|
Hello,
Since you use PM_NOREMOVE , the same message gets dispatched as long as 2 ms. You should remove the message for this purpose.
Since you do some communication, may I suggest that you do that in a seperate thread. This doesn't interfere with the GUI and enables you to program more flexible. This also saves you the DispatchMsg() function.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
It's not a very easy thing to do... I already have to many threads, and some more windows.
The idea is to give the component some time to post to my wnd the results...
Do you know why the PM_REMOVE sometimes hangs the application?
|
|
|
|
|
Hello,
Removing the message using PeekMessage probably doesn't hang your application. Your problem probably is that DispatchMsg() doesn't wait if there is no message available. That function should look like this:
void DispatchMsg()
{
MSG msg;
DWORD dwi=GetTickCount();
while ((GetTickCount()-dwi)<2000)
{
if (::PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
else
{
::WaitForSingleObject(::GetCurrentThread(), 50);
}
}
}
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hey there,
I bought a microphone that isn't loud enough, so i decided to write a driver solely for increasing the microphone volume, other thing have not to be done.
Now my question, is it possible to write a driver that acts like beeing a normal windows driver, but instead only takes the signal from the original Soundcard driver, and increases the volume of the soundcard's microphone?
Is there any kind of "Wrapper" Driver already available?
Greets,
hircs
|
|
|
|
|
|
Hi Freinds,
I am working on a dialog based MFC application, i had some combo controls and edit controls added to this application and it was working fine .... now i have added one more combo control and since then i m not been able to execute the applctaion, even it doesnt give any error but also doesnt start at all.... and if i remove the newly added combo control... the applcation works pretty fine ...
Pls help me in this regard .... thanking you all in anticipation....
Mukhan
|
|
|
|
|
Is there anything special about the control? With the control intact, temporarily add the DS_NOFAILCREATE style to the dialog. Do the dialog and the control show up?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I'm currently developing the GUI for an application that interfaces to a hardware data acquisition device. I'd like a window on the GUI that displays read-only textual status information, much like the build/debug console at the bottom of the visual studio IDE. I've placed an Edit control on my dialog and attached a CString member variable to it with global scope. Every time I want to append a new line of text to the output window I append it to the CString member using +=. This way I retain previous output messages. Every time I append some new text I proceed this with SetDlgItemText() to update the edit control text. Ive added a vertical scroll to allow read access to text outside of the edit control window. I have the multi-line style selected
The problem I have is one of orientation. Clearly I want the most recently appended lines to be visible without having to touch the scroll bar, just like on Visual studio, and even the edit box Im entering this text into. However I can't find a way of arranging this. In my application the scroll bar sits at the top of the window by default so that the first few lines of text are visible and you have to scroll down to the more recently appended lines.
Any advice on resolving this problem is greatly appreciated.
Regards,
Adrian
|
|
|
|