|
Did you start the instance of Word using something like CreateProcess() or ShellExecute() ?
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hello,
I am Using CDHTMLDialog to display an HTML Page along with some MFC Controls.
Using Reference from: http://www.codeproject.com/Articles/1094/The-MFC-CDHtmlDialog-class
&&
http://www.codeproject.com/Articles/5729/CDHtmlDialog-with-CSS-JavaScript-and-images
My query is how do I control the position of the HTML page on the dialog?
I have used OnSize function to control the lower part of the Dialog.
void CTestUIDlg::OnSize(UINT nType, int cx, int cy)
{
CDHtmlDialog::OnSize(nType, cx, 165);
CDialog::OnSize(nType, cx, cy);
}
This code helps in displaying HTML page with height of 165 and the lower part is only CDialog.
I want to achieve the following:
CDialog Size(0, 0, 500, 500) // Full Dialog
CDHTMLDialog(0, 100, 500, 165)// Middle Strip of 65 pixel
The top area of the Dialog should also contain only CDialog Controls!
I don't want to use the WebBrowser Control for this.
Any tip on how to achieve this!
Thank you!
|
|
|
|
|
|
Hi,
I am working on a simple win32 console based application in C in visual studio2005.
My application uses a third party static library.
So I have included the path of the library and the library in additional dependencies for linker input.
My code compiles and works fine if I compile this code as C++ code.
But If I want to compile this as C code, for the same library functions, I am getting unresolved external symbols.
Can any one please let me know, if I have to change anything for this library to compile as C code.?
Regards,
Sunil Kumar
|
|
|
|
|
Its possible to do that but depending on your unresolved external symbols you might have to use a thin layer of C++ between your C code and the C++ library.
|
|
|
|
|
The library is compiled as C++ code, due which the function names exported by the library are mangled.
When you compile your code as C code, the name mangling is disabled, due to which the linker looks for un-mangled version of the function calls you're using from the third party library. And hence the unresolved external symbol errors are shown.
The way out for this is use dynamic loading of that DLL.
|
|
|
|
|
Hi Malli,
thanks for the reply.
So in that case,by using dynamic loading of library using LoadLibrary, we can avoid this even the library is compiled as C++.?
Regards,
Sunil Kumar
|
|
|
|
|
Yes, provided that you have function prototype with you and the function pointer defined for the function you are calling.
|
|
|
|
|
Malli_S wrote: The way out for this is use dynamic loading of that DLL.
DLL?
|
|
|
|
|
Chris Losinger wrote: DLL?
I meant to say using LoadLibrary().
|
|
|
|
|
but the post says nothing about a DLL. it says "static library".
|
|
|
|
|
Hmm. I should have mentioned about the DLLs. I was trying to focus on dynamic linking, rather than static linking.
My mistake. I missed that.
|
|
|
|
|
Hi,
the good thing is that I have both static and dynamic libraries.
But I wanted to use only static, so that I can distribute only an exe.
But anyway, now I will have to use the dynamic library.
Thanks for the help.
Regards,
Sunil Kumar
|
|
|
|
|
If it was me I would put a C function wrapper around it. And compile that at a library. Then your app uses the second library. The dynamic loader solution works but it means that you must deal with the name mangling yourself rather than letting the compiler do it. And if the C++ requires an C++ idioms, like creating a class, then doing thing via dynamic method calls is going to be difficult.
|
|
|
|
|
But it's a third party library. He might not have the source code for that.
|
|
|
|
|
Hi,
One more thing is,it compiles properly for C++ in debug mode.
But in Release mode the same unresolved external errors, I am getting for the functions.
I have mentioned the project properties in Release mode same as in Debug mode.
But still it is unable to link to the functions in the library.
Why this behavior.Does it mean, the library is compiled in debug mode?
Regards,
Sunil.
Regards,
Sunil Kumar
|
|
|
|
|
Malli_S wrote: But it's a third party library. He might not have the source code for that.
That has nothing to do with what I said.
|
|
|
|
|
Hello everybody,
i am having text file opened in some other application(our application). if i delete this opened file from windows explorer, its deleting, so, at some point, my application crashes (while trying to write). how can i lock that file when it is use in other application?
i am using VC++ with win32.
Thanks in advance,
A. Gopinath.
|
|
|
|
|
You can use CreateFile to open an existing file with without Sharing. i.e. passing dwShareMode of CreateFile()[^] as zero.
Or you can open a file using OpenFile()[^] by passing 'OF_SHARE_DENY_READ |OF_SHARE_DENY_WRITE' to deny sharing.
|
|
|
|
|
[LockFile] locks the second file to prevent another process from accessing it while writing to it.
Sample code:
#include <windows.h>
#include <stdio.h>
void main()
{
HANDLE hFile;
HANDLE hAppend;
DWORD dwBytesRead, dwBytesWritten, dwPos;
BYTE buff[4096];
char DataBuffer[] = "This is some test data to write to the file.";
DWORD dwBytesToWrite = (DWORD)strlen(DataBuffer);
BOOL bErrorFlag = FALSE;
hFile = CreateFile(TEXT("one.txt"),
GENERIC_READ,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
printf("Could not open One.txt.");
return;
}
bErrorFlag = WriteFile(
hFile,
DataBuffer,
dwBytesToWrite,
&dwBytesWritten,
NULL);
hAppend = CreateFile(TEXT("two.txt"),
FILE_APPEND_DATA,
FILE_SHARE_READ,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hAppend == INVALID_HANDLE_VALUE)
{
printf("Could not open Two.txt.");
return;
}
while (ReadFile(hFile, buff, sizeof(buff), &dwBytesRead, NULL)
&& dwBytesRead > 0)
{
dwPos = SetFilePointer(hAppend, 0, NULL, FILE_END);
LockFile(hAppend, dwPos, 0, dwBytesRead, 0);
WriteFile(hAppend, buff, dwBytesRead, &dwBytesWritten, NULL);
UnlockFile(hAppend, dwPos, 0, dwBytesRead, 0);
}
CloseHandle(hFile);
CloseHandle(hAppend);
}
|
|
|
|
|
hello guys. I want to have a list of all the installed programs.
More specifically, I want to know how many voice messangers ( or programs with the capability of voip: like yahoo messanger) are installed on my system.
Can your suggested answer be applied to other type of softwares (like getting names of windows media player and Cyberlink Power Player).
Thanks for any answers or pointer (even a void one, I will cast it accordingly ) on this.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
|
Hello,
Stuck on a Microsoft drawing problem: The brush I'm using to draw text is being ignored, and SelectObject () returns NULL when I try to select it into a device context:
HFONT hFont = CreateFontIndirect(& logFont);
HFONT oldFont = (HFONT) SelectObject (hDc, hFont);
HBRUSH oldBrush = (HBRUSH) SelectObject (hDc, hbrush);
TextOut (hDc, 0, 0, fontName, wcslen (fontName));
The brush comes from the nativeBrush member of a .NET System.Drawing.Brush, which works correctly both before and after this.
I've tried using DrawText () instead, with the same result. Can anyone point out what I'm doing wrong? Thanks!
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
Brushes are used to fill the interior of filled shapes. They are not used to draw text.
TextOut() and DrawText() use the text and background colors currently selected by the device context. These can be set using SetTextColor() and SetBkColor() .
SelectObject() returns the object that is going to be replaced. This may be NULL if there is actually no such object selected into the device context. It is not an error condition. The return value is usally used to restore the old state after drawing has been done.
|
|
|
|
|
Hmm... I'm using the same brush to draw text in the .NET half of the application. These are complex patterns (linear gradient and hatch brushes), and the text correctly appears with these textures in GDI+/.NET.
I'm using GDI (no plus) in this part because GDI+ doesn't support OpenType or PostScript fonts (only TrueType).
So how can these patterns be used in text under GDI?
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|