|
The errors do have line number references, so better than nothing, eh? Maybe you already know... the Beta-2 is available for download, or cd ordering (msdn web site). Maybe the ide will be more useful!
|
|
|
|
|
Hi,
So I am programming in C++ to access office documents in the background (so nothing is visible)
It's important that I don't get any visible notifications or pop-up windows.
Now working with Powerpoint and Excel gives no problem.
But if I try to open a Word document that allready is open I get this annoying messagebox "Open as Read Only - Notify - Cancel"
This messagebox should NOT appear because I set the "DisplayAlerts" - property of the Word application to false
Plus I explicit say to open the document as "read only"
If I run a macro (vb) with these requirements I don't get any messages but in C++ I do
Here's the code in c++
dhCheck( dhCreateObject(L"Word.Application", NULL, &wdApp) );
dhPutValue(wdApp, L".Visible = %b", FALSE);
dhPutValue(wdApp, L".Assistant.On = %b", FALSE);
dhPutValue(wdApp, L".DisplayAlerts = %d", 0);
dhGetValue(L"%o", &wdDoc, wdApp, L".Documents.Add");
dhGetValue(L"%o", &wdDoc, wdApp,
L".Documents.Open(%s%b%b%b%s%s%b)", inpath, FALSE, TRUE,
FALSE, "", "", TRUE);
NOTE that I explicit set the DisplayAlerts to False (0)
PLUS that I open the file as READ ONLY
So I really don't understand
1: why I still get A message
2: why I am asked again to open the file as read only after I allready
explicit told the application to do so
It's really important that I find a solution or at least a decent explanation
Hopely someone can help me here
christophe.keteleer@gmail.com
|
|
|
|
|
I'm a little confused,...what are the dhPutValue and dhGetValue names? Wrapper classes? If this was a Visual C++ .NET application, you'd be using Interop to operate the Word Application object. Are you just opening ONE Word Application?
I would guess that some default value is overriding your DisplayAlerts setting; the Word type library is so humongeous that,...well, you know,...I'm lazy.
|
|
|
|
|
Perhaps some of you who are more experienced with Windows programming could answer this question for me. I have the ability to access values in the Windows registry but when I try to access a variable which holds path information, I get an "Access Denied" error. The variable I am trying to read is HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\History. I'm using RegOpenKeyEx and RegQueryValueEx to read the value but I must be missing something here. This is the code I'm using.
void ShowError()
{
LPVOID lpMsgBuf;
if (!FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL ))
{
// Handle the error.
return;
}
// Process any inserts in lpMsgBuf.
// ...
// Display the string.
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
// Free the buffer.
LocalFree( lpMsgBuf );
}
BOOL GetHistoryFolder()
{
HKEY hKey;
char szHistory[100];
DWORD dwBufLen=100;
LONG lRet;
LPDWORD Type;
lRet = RegOpenKeyEx( HKEY_CURRENT_USER,
"Software\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
0, KEY_QUERY_VALUE, &hKey );
if( lRet != ERROR_SUCCESS ) {
ShowError();
return FALSE;
}
lRet = RegQueryValueEx( hKey, "History", NULL, (LPDWORD) &Type, (LPBYTE) szHistory, dwBufLen);
if( (lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE) ) {
ShowError();
if (Type == (LPDWORD)REG_SZ)
printf("Type is REG_SZ\n");
else
printf("Type is %ld\n",Type);
return FALSE;
}
RegCloseKey( hKey );
printf("History is [%s]\n",szHistory);
return(TRUE);
}
Please help!
Rex
|
|
|
|
|
I guess I figured it out, thanks for considering helping me.
|
|
|
|
|
Hi,
We are developing KIOSK applications for banks. In our KIOSKS, we are using Panasonic KX-7100 printers. If you have ever seen a KIOSK application, no window or dialog box except the ones that are belong to related application is allowed to appear. So we must restrict printer related dialog boxes and error windows inside our applications. For example when paper finished, printer shows a “Printer Status Display” window .
How can we understand out of paper error inside our application not to show this window, but our own dialog box? There is a class called Win32_printer, but i coulnt find any sample code. Is there anybody that can help me?
|
|
|
|
|
Hi All,
I am working on a project which deals with diffgram files.I am facing a problem to store the values of elements from the diffgram file to a database table.I can create the database table but how to store the values from difgram to those tables lies the challenge ahead of me.
Can anybody send me link or the code snippet for this.
Thanks a Million.
Gaurav
|
|
|
|
|
I need to convert a char *test; to a int.
how can I do that?
|
|
|
|
|
Converting char to int is implicit. Converting a string to an int is simple - use atoi.
BTW, this is not the C++ forum.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Here is convertion from char to int
char t = '7';
int i;
i = atoi( (CString)t );
//now i is 7;
m0n0
|
|
|
|
|
|
Why on earth do you cast to a CString ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hail Programmers
I am trying to compile a VC++Net2003 Project that includes the following struct:
typedef struct xlref<br />
{<br />
WORD rwFirst;<br />
WORD rwLast;<br />
BYTE colFirst;<br />
BYTE colLast;<br />
} XLREF, FAR *LPXLREF;
The compiler chokes giving the following error message:
"c:\call.h(28) : error C2146 : syntax error : missing ';' before identifier 'rwFirst'"
MSDN suggests that this error occurs "as a result of compiler conformance work that was done for Visual Studio.Net 2003: explicit specialisations no longer find template parameters from primary template."
If anyone speaks MSDN, I'd be grateful if could you tell me how I fix the struct?
Regards
Jeremy
|
|
|
|
|
Try to add this header to your code:
#include <windows.h>
|
|
|
|
|
Many thanks RainbowWyrm - Yes, I had left out <windows.h> - Thanks again
|
|
|
|
|
I am developing directx filters based application and while building the project i am facing this problem. I think this problem is a general one.
CaptureFilter error LNK2020: unresolved token (0A000014) new
CaptureFilter error LNK2020: unresolved token (0A000029) delete
Can you tell me why i am getting this error?
thankx
|
|
|
|
|
|
Hi Ursus,
i went to the site but it does not have much information. I really dont know where these functions are defined.
it seems there is a problem when one develops managed c++ applications.
ve
|
|
|
|
|
As you no doubt know, new and delete are C++ language keywords. And, if you are writing a filter in DirectShow, which is an unmanaged library, you shouldn't be getting that error for any reason that I can imagine. It doesn't make sense. Are you using the /clr switch?
I really can't imagine why that is happening, except that your error is SO HUMONGEOUSLY STUPID, that the compiler doesn't know which possible error message of thousands to send.
I hope that you have a sense of humor. I do stuff like that all the time (I'll forget something REALLY obvious and basic), and, I get the most ridiculous error messages. You know something is seriously wrong, but, the specifics are a mystery,...and, then, it dawns on you.
You'll figure it out, I'm sure.
|
|
|
|
|
well i need to figure it out. yes i agree that the error is very stupid. i looked up the code i am just stuck up with this error. I am getting any idea why i am gettting this error.
ve
|
|
|
|
|
Just in case you didn't get this on MSFN,...
Hi eligeti vinod,
It's me, ursus zeta, from CodeProject. I googled your Link error code and discovered that you've posted all over the Internet. And I can't seem to get into the CodeProject for some reason,...
Anyway, after rereading your C++ command Line and Linker options, I noticed that you used the "/clr" switch, making your DirectShow filter DLL a managed .NET DLL.
I don't know if you are aware of it, but, the DirectShow object libriaries are 'unmanaged' COM libraries; .NET and COM types are NOT compatible. I assumed you were aware of this when I responded to your original post.
When using COM components in .NET applications, the correct technique is to use System.Runtime.Interop which manages the data exchange between the two entities. The COM Interop creates wrappers for all COM types so that they are usable in a .NET environment.
In your case, I think that you want to create an application that is unmanaged (by the Common Language Runtime); in other words, a Win32 application.
Review the Samples that accompany the C++ DirectShow SDK, and you will see that they do not use the /clr switch.
This is from the DirectShow FAQ at the MSDN site:
Will DirectShow ever be accessible through managed code?
There are no current plans to implement a "Managed DirectShow" platform. You can use COM interop to create DirectShow client applications in managed code, but creating filters that depend on the Common Language Runtime (CLR) is not recommended for performance reasons.
|
|
|
|
|
one question. is it not possible to call managed .NET code from directX filters which r unmanaged. Well actually my filter is whut i copied from the pushource filter of the sample provided by the directx sdk 2003. when i created the project i checked Console Application(this i suppose is .net) and not Win32 Console application and then changed to dll option.
i commented all lines of using statements which uses the managed code and still it gives me the same error.
Can you tell me how i can disable /clr option?
|
|
|
|
|
Happy Friday! Gurus,
I am trying to use the logics from Intel OpenCV DLLs, which were originally compiled by MSVC++ 6. From C# or ASP.NET Apps, when I was trying to add reference to these DLLs (i.e. cv096.dll or cxcore096.dll), I got this error:
“A reference to ‘D:\Programs\OpenCV\bin\cv096.dll’ could not be added. This is not a valid assembly or COM component. Only assemblies with extension ‘dll’ and COM components can be referenced. Please make sure it is a valid assembly or COM component.”
Note: The source code of Intel OpenCV DLLs is open source. I can open this source code project in either MSVC++ 6 or VS.NET 2003.
Question: How can I use these DLLs in .NET environment, preferably in ASP.NET and C# projects?
Thanks with a million
Khang
|
|
|
|
|
|
As mentioned in the previous post, you can't add a reference to the DLL since it's neither a .NET assembly, nor exposing COM interfaces -- when you add a reference to a COM DLL VS.NET just generates a .NET P/Invoke wrapper around it so you can use it without declaring things yourself.
Again, you can either go down the route of writing DllImport & P/Invoke stubs (although if you're using reasonably complicated data structures this can be time consuming unless someone else has already converted them).
Alternatively, you can use the (rather cool in my opinion) It Just Works functionality within MC++. Effectively you write a .NET wrapper around the functionality exposed by the Intel libraries by linking etc. as you would with MSVC++6. Now, I'm a little rusty on this, I've not done any MC++/interop code for a good while now, but it should be relatively straightforward. Effectively you compile your assembly with the /CLR compiler switch, this in turn generates managed code, including the P/Invoke code that would otherwise be up to you to write in C#. Of course, you'll need to make sure you link with the libraries, and include the headers.
If you get stuck with that I'm sure people will be able to give you more detailed instructions.
--
Paul
MS Messenger: paul -at- oobaloo-co-uk
|
|
|
|
|