|
Not exactly sure what you are doing in your worker thread.
But if you are doing
chat_window_rich.SetSel(GetWindowTextLength(chat_window_rich), -1);
chat_window_rich.SetSelectionCharFormat(cf);
chat_window_rich.ReplaceSel(buff);
in your worker thread
Create a handler for a user message that does something like this
LRESULT OnAppendText(WPARAM wParam, LPARAM lParam)
{
int start, end;
chat_window_rich.GetSel(&start, &end);
chat_window_rich.SetSel(GetWindowTextLength(chat_window_rich), -1);
chat_window_rich.SetSelectionCharFormat(cf);
chat_window_rich.ReplaceSel( (LPCTSTR) wParam);
chat_window_rich.SetSel(start, end);
}
From your worker thread send (or post - you would be responsible for allocating and deallocating the string you want to append) the user defined message to the main thread when you want to append text.
|
|
|
|
|
hello, i must to write program that will sit in the systray and will monitor pressing "OK" button in the print dilaog box in following programs( word, notepad, adobe reader nad etc.)
my program will get filename and it's size of the data being proccessed to printer.
i must to use hooks and API ho i can do it?
it's nice to be important
|
|
|
|
|
Thank you for the code instructions. It should work!;)
|
|
|
|
|
|
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
We have an ATL application which hosts an IE browser.
We create the browser instance and subscribe to it as follows:
STDMETHODIMP CIEdispatcher::createIE(void)
{
// TODO: Add your implementation code here
HRESULT hr = E_FAIL;
if (m_spIE == NULL) // Can only start one instance of IE4
{
// Create an instance of IE4 and get the IWebBrowser2 interface pointer.
// IWebBrowser2 represents the application as well as the WebBrowser control.
hr = CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER,//CLSCTX_INPROC_SERVER,//
IID_IWebBrowser2, (void**)&m_spIE);
if (SUCCEEDED(hr))
{
m_spIE->put_Visible(TRUE); // We want to see IE4 don't we???
cout<< " Registering for browser events " << endl;
AtlAdvise(m_spIE,GetUnknown(),DIID_DWebBrowserEvents2,&m_dwCookie);
CComVariant vurl(_T("http://www.yahoo.com"));
hr = m_spIE->Navigate2(&vurl, &ve, &ve, &ve, &ve);
}
return S_OK;
}
However the program exists before the documentcomplete is fired!!!So we try to capture the readystate property before returning from the method as follows:
READYSTATE result;
do
{
m_spIE->get_ReadyState (&result);
} while (result != READYSTATE_COMPLETE);
But even then the program exits before documentcomplete is fired.
However if we keep the program running indefinitely,documentcomplete is fired ,and we can load the document tree.
What should we do to prevent the program from exitting before documentcomplete is fired? We have also tried get_statustext as Done with no avail.
|
|
|
|
|
rana74 wrote: However the program exists before the documentcomplete is fired!!!
How why does it exit?
If that do/while loop runs int he main thread of your application how does it exit?
What sort of application is this? Service, Windows, Console?
led mike
|
|
|
|
|
|
I am trying to connect to MDP provider using OLE DB For OLAP following these steps:
1-i'v got the List of providers..and choose one of them
2-i called ParseDisplayName() ,..the i called BindMoniker() method as written in the code below...
3-When i Call ppIDBInitialize->Initialize(); ..i got Access voilation exception
can any one help me please....
Here is the code:
ULONG chEaten = 0;
hr = pIParseDisplayName->ParseDisplayName(pIBindCtx,rgEnumInfo[i].wszParseName, &chEaten, &pIMoniker);
ppIDBInitialize=NULL;
hr = BindMoniker(pIMoniker, 0, IID_IUnknown,(void**)&ppIDBInitialize);
rgProps[0].dwPropertyID = DBPROP_INIT_LOCATION;
rgProps[0].vValue.vt = VT_BSTR;
rgProps[0].vValue.bstrVal = SysAllocString(L"server");
rgProps[1].dwPropertyID = DBPROP_INIT_DATASOURCE;
rgProps[1].vValue.vt = VT_BSTR;
rgProps[1].vValue.bstrVal = SysAllocString(L"FoodMart 2000");
rgProps[2].dwPropertyID = DBPROP_AUTH_INTEGRATED;
rgProps[2].vValue.vt = VT_BSTR;
rgProps[2].vValue.bstrVal = SysAllocString(L"SSPI");
DBPROPSET PropSet;
PropSet.rgProperties = rgProps;
PropSet.cProperties = 3;
PropSet.guidPropertySet = DBPROPSET_DBINIT;
IDBProperties *pIDBProperties=NULL;
hr=ppIDBInitialize->QueryInterface(IID_IDBProperties,(void**)&pIDBProperties);
hr=pIDBProperties->SetProperties(1, &PropSet);
hr = ppIDBInitialize->Initialize();
|
|
|
|
|
Check the result (hr) of:
hr = BindMoniker(pIMoniker, 0, IID_IUnknown,(void**)&ppIDBInitialize);
I'm guessing ppIDBInitialize is still NULL. Put a breakpoint on that line in debug mode and check it.
(I know little about the OLE DB or OLAP, so I don't know why it's failing).
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
I am trying to connect to MDP provider using OLE DB For OLAP following these steps:
1-i'v got the List of providers..and choose one of them
2-i called ParseDisplayName() ,..the i called BindMoniker() method as written in the code below...
3-When i Call ppIDBInitialize->Initialize(); ..i got Access voilation exception
can any one help me please....
Here is the code:
ULONG chEaten = 0;
hr = pIParseDisplayName->ParseDisplayName(pIBindCtx,rgEnumInfo[i].wszParseName, &chEaten, &pIMoniker);
ppIDBInitialize=NULL;
hr = BindMoniker(pIMoniker, 0, IID_IUnknown,(void**)&ppIDBInitialize);
rgProps[0].dwPropertyID = DBPROP_INIT_LOCATION;
rgProps[0].vValue.vt = VT_BSTR;
rgProps[0].vValue.bstrVal = SysAllocString(L"server");
rgProps[1].dwPropertyID = DBPROP_INIT_DATASOURCE;
rgProps[1].vValue.vt = VT_BSTR;
rgProps[1].vValue.bstrVal = SysAllocString(L"FoodMart 2000");
rgProps[2].dwPropertyID = DBPROP_AUTH_INTEGRATED;
rgProps[2].vValue.vt = VT_BSTR;
rgProps[2].vValue.bstrVal = SysAllocString(L"SSPI");
DBPROPSET PropSet;
PropSet.rgProperties = rgProps;
PropSet.cProperties = 3;
PropSet.guidPropertySet = DBPROPSET_DBINIT;
IDBProperties *pIDBProperties=NULL;
hr=ppIDBInitialize->QueryInterface(IID_IDBProperties,(void**)&pIDBProperties);
hr=pIDBProperties->SetProperties(1, &PropSet);
hr = ppIDBInitialize->Initialize();
|
|
|
|
|
Dear all..
I am using CxImage library to decode a JPEG stream from file, and it is fine. My problem is, how can I keep the image not to disappear from the dialog box everytime I change my window (alt-tab, or minimizing my app.).
I am using this code:
<br />
CDC *pDC = m_ImgHolder.GetDC();<br />
CRect pRect;<br />
m_ImgHolder.GetClientRect(&pRect);<br />
if (isImage) image->Draw(pDC->GetSafeHdc(), 0, 0, pRect.Width(), pRect.Height(), 0, true);<br />
I usually put this code inside OnPaint() method, but it does not seems to work now...
Need help...
Thanks in advance!
|
|
|
|
|
If it is done in OnPaint, then it should work. Did you check with your debugger if the code is executed when your window is refreshed ?
Also, what is the value of isImage ?
|
|
|
|
|
Hi, thank you for your reply...
I already put the code on OnPaint(). And this thing happen: when I use alt-tab to move to another window, and return to my app., the image disappear. But if then I move (drag) the dialog so the image section goes outside the screen and return it back, the image also returns....
isImage is only a boolean of confirming that the image data is valid
isImage = (image.IsValid())?true:false;
thank you
|
|
|
|
|
Did you check with your debugger if the code that draws your image is called in that case ?
|
|
|
|
|
Hello everybody,
I've got the following question:
I would like to use a check box with the BS_AUTOCHECK,BS_PUSHLIKE style.
Furthermore I want to display a bitmap (bitmap1) on top of this check box -
button.
When I push the button it should show me another bitmap (bitmap2).
Pushing again should show me the first one again... -> use as a toogle.
But I can't get it to work. Trying with 2 strings -> no problem.
With SetBitmap() and 2 bitmaps -> no failure, but also no bitmaps displayed.
Somebody an idea?
Raja Bose
|
|
|
|
|
set your checkbox as an "image or icon" control (in the resource editor).
then, in the on click event handler, put this code to set the image on the button :
HICON hIcon;
if (m_checkBox.GetCheck() == TRUE) {
hIcon = (HICON)LoadImage(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDI_IMAGE_STATE1),
IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
}
else {
hIcon = (HICON)LoadImage(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDI_IMAGE_STATE2),
IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
}
if (hIcon) {
m_pbVariablesListState->SendMessage(BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
}
in your OnInitDialog() (or the function to iit your frame), call this event handler one time to initialize the check box...
this is only an example, which work for an icon check box...
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Thank you very much Mr. TOXCCT, Mr. RAVI and everyone who helped me it seems to be working great with all ur samples.... Even i am able to load a bitmap file with the same concept
THANKS A LOT
Raja Bose
-- modified at 2:51 Friday 5th May, 2006
|
|
|
|
|
|
|
Hello,
After trying to figure this out for days, and getting more and more frustrated, I decided that I need some help with my problem.
My problem is this, I'm rying to create a webservice that allows me to run Java scripts in an Adobe InDesign instance. I've got sample code of how someone else created it in Visual Basic, but I've only got visual c++ v7.1 (bought it for an InDesign plugin Project, wich we're not going to do because it's just to complicated, and the Javascript seems to be enough for our needs)
Seeing that the only code that he needed to insert himself is about 8 lines, and the rest was automaticly generated by starting a new webservice project, I foolishly thought that it shouldn't be that hard to recreate that functionality into c++.
Creating the webservice was that easy indeed, you even got a "hello world" without even coding a single line .
The VB I want to recreate is:
Public Function DoScript(ByVal script As String) As String<br />
Try<br />
Dim ind As InDesign.Application<br />
ind = CreateObject("InDesign.Application.CS2", "localhost")<br />
Dim x As String = ind.DoScript(script, InDesign.idScriptLanguage.idJavascript)<br />
Return x<br />
Catch ex As Exception<br />
Return "An error occurred: " & ex.Message<br />
End Try<br />
End Function
I found this article on this site and used it as a lead.
http://www.codeproject.com/Purgatory/Adobe_InDesign_COM_object.asp[^]
So I started by adding a reference to the InDesign com object to my project, and as far as I can see that was succesful.
But when I want to compile the following code, I get the following error message:
<br />
#include "stdafx.h"<br />
#include "InDesignCS2Class.h"<br />
#include "Global.asax.h"<br />
<br />
namespace InDesignCS2<br />
{<br />
String* InDesignCS2Class::RunScript(String* script)<br />
{<br />
// create an InDesign instance
InDesign.Application app = (InDesign.Application) COMCreateObject("InDesign.Application");<br />
// get a reference to the current active document
//InDesign.Document doc = app.ActiveDocument;
// get the first page
//InDesign.Page page = (InDesign.Page) doc.Pages[1]; //1e pagina
// get the first textframe
//InDesign.TextFrame frame = (InDesign.TextFrame) page.TextFrames[1];
// write contents of textframe
//Console.WriteLine(frame.Contents.ToString());
// set contents of textframe
//frame.Contents = "Andere content";
<br />
return script;<br />
}<br />
};<br />
error C2065: 'InDesign' : undeclared identifier
Can anyone please tell me what I'm doing wrong, or what I've forgotten to do.
TIA,
Erik Bruinsma
|
|
|
|
|
You are working in C++ right ?
The code of the article is for managed (I suppose because I'm not familiar with the syntax). Or at least, this isn't C++.
That's why you get errors.
|
|
|
|
|
Hi Cedric,
Yes, I'm working in Microsoft Visual C++ .NET version 2003 Standard.
That will be the problem then, but can you tell me what is the correct way to use a/the InDesign com object, because I'm completely lost.
Erik
|
|
|
|
|
ebruinsma wrote: I'm working in Microsoft Visual C++ .NET version 2003 Standard.
this doesn't mean in which language you code (i leave in france, but could be speaking english, german or chinese).
Cedric's question is : "do you program in Native C++, Managed C++, C#, VB.NET..." ?
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Sorry, I don't know what the diference is between those languages , I thought that when I use MicroSoft's visual C++ that I was using c++, with their compiler.
How can I see what I'm using.
What I did to create the project, was:
Choose new project from the file menu, and choose: visual c++ project/.net/ ASP.NET web service.
So, my question still is what do I need to do, to get a webservice that allows me to call runscrip in InDesign.
TIA Erik.
|
|
|
|
|