|
Hi,
I´m trying to automate Microsoft Access from Microsoft Visual C# .NET with the following code. My problem is that all that is showed is an Access Window and not my
Access report. Can anyone tell me what I do wrong?
Access.Application oAccess = null;
oAccess = new Access.ApplicationClass();
oAccess.OpenCurrentDatabase(
"c:\\InvoiceDB.mdb", //filepath
false,null
);
//View report InvoiceFoundation
oAccess.DoCmd.OpenReport(
"InvoiceFoundation", //ReportName
Access.AcView.acViewPreview, //View
System.Reflection.Missing.Value, //FilterName
System.Reflection.Missing.Value,
Access.AcWindowMode.acWindowNormal,
System.Reflection.Missing.Value//WhereCondition
);
oAccess.Visible=true;
oAccess.CloseCurrentDatabase();
THX in advance
Thomas Andersson
|
|
|
|
|
Hi!
I want to marshall a struct with 2 different char sets one Unicode and one Ansi.
This constellation doesn't work, because the CharSet.Unicode defines the char set for both types.
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
public class MOUNT_STRUCT
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)]
public string wszVolume;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=65)]
public string wszVolume2;
}
The next one doesn't worke too:
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
public class MOUNT_STRUCT
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)]
public string wszVolume;
[MarshalAs(UnmanagedType.LPStr, SizeConst=65)]
public string wszVolume2;
}
how can i define 2 different charsets for one struct.
I tried several other options, which didn't work.
Is there no solution?
|
|
|
|
|
I'm not quite sure how to ask this or if it's even possible.
I know windows has some sort of basic drag and drop events that different programs use to automatically open their respective types of files (i.e. .doc files dragged onto MS. Word etc.)
now my question is say i want to trap the windows messages for the drag-drop event of the MS. Word program from an external program (it's probably going to be a windows service) to get say the file name being loaded.
I have used spy++ to try and look through the messages created for different programs when i drag and drop files to them but i'm not even sure which message i need to be looking at or even where to start.
to give you an example of what i basically want to do:
the window service would periodically monitor a program or programs such a word or paintshop when a windows message for a file drop is sent the service finds the file name and extension and either pops up an error dialog or automatically opens it in the correct program.
Hope to hear from someone on this sooner or later
p.s. if it's completely imposible to do tell me too so i don't waste my time with this
thanks
Ryan
|
|
|
|
|
The only way to do this is to hook the applications message loop. I believe that's possible in C++, I doubt it's possible in C#
There's an article on CP about Minesweeper ( the game ). I believe the author hooks into Minesweeper and adds new menu options. He is probably hooking the event loop, so it could be worth checking out. Just search for Minesweeper, how many articles could there be ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I could not find any specifc info on the site for the issue I am trying to solve, so I hope someone here has some ideas. I am working with some code created to run test suites and setup scripts. One part of the system installs an agent onto a client PC. I need to find a way to pass command line options to the msi installer UI so that the installation can be run silently. MSI installers have the necessary options to run silently, but so far I have not found a way to pass options from the command line to the UI so that several dialog boxes can be filled without having to get input from a user. Has anyone here run into this and managed to come up with a solution?
|
|
|
|
|
Here is the documentation of MSIEXEC's command line options: MSIEXEC on MSDN[^]
To give additional values for global properties you have to put them at the end of your call to msiexec in the form:
msiexec /i Sample.msi PROPERTY=VALUE
Regards,
mav
|
|
|
|
|
mav,
I have found the particular documentation you have referenced, and have spent several hours reading it and trying the above syntax. However, it appears that there is no way to link the properties on the UI dialogs and the Property table in the msi database. I have used Orca to look at the database and none of the properties from the UI dialogs are present except for one entry for the each of the edit controls (EDITB1 through EDITB4). Each of these entries are global (all upper case), but do not seem to be connected to anything that actually displays on the UI. They all have a value of 1, but changing that using the above syntax does not do anything - at least that I can determine.
I know the syntax works, because I can set things like TARGETDIR and see the change in the dialog when it is displayed.
|
|
|
|
|
I know it can be a bit confusing, but just try the following:
In your setup project, add a user dialog with textboxes.
Then set Edit1Property to TEST1 and Edit1Value to [TEST1] .
When you build and run your setup, the user dialog will pop up and there will be no entry in the first textbox.
If you call your setup using
msiexec /i mysetup.msi TEST1=ThisIsATest
then the first textbox will show ThisIsATest instead.
Regards,
mav
|
|
|
|
|
mav,
Thanks a bunch. The missing piece of the puzzle (which I found nowhere in the docs I read) is this:
'Then set Edit1Property to TEST1 and Edit1Value to [TEST1]'
A most critical bit of information and much appreciated!
|
|
|
|
|
mav,
Thanks a bunch. The missing piece of the puzzle (which I found nowhere in the docs I read) is this:
'Then set Edit1Property to TEST1 and Edit1Value to [TEST1]'
A most critical bit of information and much appreciated!
|
|
|
|
|
mav,
I have another question regarding passing in Property values from the command line.
The dialog has two properties. One is normally blank and the method you describe works perfectly to set it from the command line during a silent install. The second property has a default value that one might wish to set to a non-default value from the command line during a silent install.
Now, it seems that one must somehow use the MsiSetProperty method in a custom action that checks to see if the passed in value of the property is a null string, and if so, sets it to the default value. It also seems that one would have to write a custom dll to do this, and link it properly in the custom actions editor in the deployment project. Is this the correct way to accomplish this or is there something simpler?
|
|
|
|
|
Mav, thanks for sharing this information - it was very helpful in understanding how to pass a command line parameter to the Installer and see that value show up on a text field. I have a question though, how can I programatically detect that I didn't get a command line parameter and populate those text fields another way? Perhaps I read the registry or a text file. I want to handle the situation where I prompted a user for something during the first install, and subsequent installs I show them the previous value and allow them to change it - unless I get a command line argument - which trumps this logic.
Thanks again for sharing the information though...very helpful. -Ron
|
|
|
|
|
Does anyone have any links to example code for (any language, but prefer .net something) using Microsoft Live Communications Server? I have been reading the msdn info, but haven't found sample code for a simple app. I just want to set up a small messaging window embedded in a help desk tool. It doesn't have to be fancy, just queue messages to the help desk, and allow simple text messages to be typed back and forth like a chat app, but without all the fancy features.
An alternative would be a way to embed a windows messenger pane in a .net app.
Thanks for any info you can point me to.
|
|
|
|
|
Hello all,
I am interested in adding several HTML files (and images from those files) to a solution and navigating a winform web browser control (from VS 2005 beta2) to those files when the user clicks through links on one of the pages. Can you tell me how these files are added to a solution/project and provide an example of the path that would be used in the code to navigate to them? Thanks for your help!
-CS
|
|
|
|
|
add->existing file. You can add any sort of file you want, I thought. If not, perhaps you need to add as a resource ?
If the file is on disc, then you just need to give your browser the full path to the file, and it should render it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for the reply Christian. I added an html file and an included jpg image using your add->existing file recommendation. The problem now is that I need a relative path to the file because the user will not enter the url themselves. This is going to be a relatively small set of html help pages that will be stored locally and the browser will open to the first page within the winform browser control when the user clicks on the help menu. Is this possible?
Thanks again.
-CS
|
|
|
|
|
You can get the path to your application directory if you need an absolute path. Otherwise, the relative path from your exe is going to be known, isn't it ? Unless you're going to edit the files, I don't see why they need to be part of your 'solution' anyhow, just put them in a folder in a known location, relative to the exe.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks again for your help.
-CS
|
|
|
|
|
hello,
I am creating an application in .NET I want the application to display a message to inform the user that the .net framework should be installed instead of saying there is a missing dll when the user tries to run the application
|
|
|
|
|
|
Your requirements are self excluding. You can't create a .NET application that checks to see if the .NET Framework is installed. It HAS to be installed before you launch your application, otherwise, how is it going to launch in the first place?
You have two options.
1) Your installer must handle installing the .NET Framework required by your application.
2) You write a launcher application in Visual C++ (not Managed C++!!) that checks for the existance of the correct version of the .NET Framework, then if found, launches the real application, and if not, puts up a dialog telling the user to install the correct version of .NET.
Option #1 is MUCH easier to deal with.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
<br />
public void task()<br />
{<br />
Thread.Sleep(9000);<br />
}<br />
private void button_Click(object sender, System.EventArgs e)<br />
{<br />
this.progressBar1.Value=0;<br />
Thread t=new Thread(new ThreadStart(task));<br />
t.Start();<br />
while((t.ThreadState & (System.Threading.ThreadState.Stopped | System.Threading.ThreadState.Unstarted)) == 0)<br />
{<br />
if(this.progressBar1.Value==this.progressBar1.Maximum)<br />
{<br />
this.progressBar1.Value=this.progressBar1.Minimum;<br />
}<br />
this.progressBar1.PerformStep();<br />
Thread.Sleep(500);<br />
}<br />
t.Join();<br />
}<br />
works the first time, progressbar progresses nice and neat, never works again. what am i missing here?
|
|
|
|
|
You'd be better off encapsulating your ProcessBar code into it's own seperate control. Something that includes it's own Timer to increment itself. You could than use this control in whatever project you wanted and you wouldn't have to worry about coding some custom garbage like what you posted.
Take a look at this[^] article on MSDN for an example.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I don't know how it works the first time. You are blocking the UI thread by looping till the worker thread completes. So your calls to PerformStep won't really get through till button_Click completes, by which time you're already done.
I'd suggest that you update the progress bar from the worker thread (by using BeginInvoke/Invoke as this[^] article describes.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
i make a query on my database.
I want the image data inside a row.
I select it and i start to read data.
The problem is that sometimes there is no data inside, so if i try to read i get exception.
Can i check if there is data inside that field before start ot read?
That field doesn't support NULL default value.
i use Microsoft Access database .mdb and ADO.NET
|
|
|
|