|
Look at Environment.GetCommandLineArgs()
Scott
-- modified at 17:13 Friday 19th May, 2006
Sorry, somehow I replied to the wrong message.
|
|
|
|
|
Scott Serl wrote: Sorry, somehow I replied to the wrong message.
I think there's a bug in the message board. My replies sometimes (but rarely) go to the wrong messages too.
|
|
|
|
|
I have got a method that recursively loops through directories and pulls either Pictures or Plans out of there respective directory.. Each plan or picture may or may not have a description associated with it.. I finally got the method to where everything is in sync and not throwing any errors..
Here is what i need help with..
Where i keep calling this method while i am still in the method but i would like to do this with these changes..
1. Remove the parameters and somehow reset the true and false with in the method itself
2. What is the best way to keep track of the built objects while the method is called over and over.. i loose my values when recalling...
I guess what i am saying is that once i am in the method i need a way to recursively keep calling the method and be able to keep track of my built object and then i need a way to step out of the method after certain events have happened..
One of the reason that i am asking is becasuse i just flat out need some advice on this one..
PLEASE.... SOS
Next (s)
End If
FileHandler(False, True) <-----something different here..
End Sub
------------------------
Thanks..
erik
Private Sub FileHandler(Optional ByVal ForPlan As Boolean = True, Optional ByVal ForPic As Boolean = False)
Dim strPlans() As String = Directory.GetFiles(Server.MapPath(m_Path & "Plans"))
Dim strPics() As String = Directory.GetFiles(Server.MapPath(m_Path & "Pictures"), "s_A-F-C-C-*")
Dim gstrFiles() As String = {}
Dim strPlanDesc() As String = Directory.GetFiles(Server.MapPath(m_Path & "Plans/Temp/"))
Dim strPicDesc() As String = Directory.GetFiles(Server.MapPath(m_Path & "Pictures/Temp/"))
Dim gstrDescr() As String = {}
Dim oFiles As AFCCServices.Files = Nothing
Dim strDirecType As String = ""
Dim strExt As String = ""
Dim strHolder As String = ""
Dim iNum As Byte = 0
---I know this is not right but i am still trying to figure all of this out
Dim i As Int16 = CShort(strPics.Length)
Dim ii As Int16 = CShort(strPlans.Length)
Dim iii As Int16 = i + ii
Dim aServ(iii)As AFCCServices.Files
-----
Dim aFsPicDescr(strPicDesc.GetUpperBound(0)) As AFCCServices.Files
Dim aFsPlanDescr(strPlanDesc.GetUpperBound(0)) As AFCCServices.Files
If ForPlan = True Then
gstrFiles = strPlans
gstrDescr = strPlanDesc
End If
If ForPic = True Then
gstrFiles = strPics
gstrDescr = strPicDesc
End If
If gstrFiles.Length > 0 Then
For Each s As String In gstrFiles
oFiles = New AFCCServices.Files
oFiles.Name = Path.GetFileName(s)
If ForPlan = True Then oFiles.Type = Global.AFCCServices.FilesType.Plan
If ForPic = True Then oFiles.Type = Global.AFCCServices.FilesType.Picture
s = Path.GetFileName(s)
strExt = Path.GetExtension(s)
s = s.Replace(strExt, "")
If gstrDescr.GetUpperBound(0) > 0 Then
For Each ss As String In gstrDescr
strHolder = ss
strHolder = Path.GetFileName(strHolder)
strExt = Path.GetExtension(strHolder)
strHolder = strHolder.Replace(strExt, "")
If strHolder.Replace("p_AFCC_PlanRef_", "") = s.ToString Then
'Get the text from the text file
Try
If ForPlan = True Then strDirecType = "Plans"
If ForPic = True Then strDirecType = "Pictures"
' Create an instance of StreamReader to read from a file.
Using sr As StreamReader = New StreamReader(Server.MapPath(m_Path & strDirecType & "/Temp/" & Path.GetFileName(ss)))
Dim line As String
' Read and display the lines from the file until the end
' of the file is reached.
Do
line = sr.ReadLine()
oFiles.Description = oFiles.Description & (line)
Loop Until line Is Nothing
sr.Close()
End Using
Catch e As Exception
' Let the user know what went wrong.
End Try
End If
Next (ss)
End If
If ForPlan = True Then aFsPlanDescr(iNum) = oFiles
If ForPic = True Then aFsPicDescr(iNum) = oFiles
aServ(iNum) = aFsPlanDescr(iNum)
iNum = CByte(iNum + 1)
Next (s)
End If
FileHandler(False, True)
End Sub
|
|
|
|
|
Hi everbody,
I am struggling with an error I do not understand. I intend to create a Windows Service to install and run in a SQL server to query a DB every few seconds, and to broadcast a UDP message to all clients within the network so that they can perform a task if need.
Now I created a regular Windows Application for testing purposes, and got it work just fine. The form has only a Timer that, when it ticks, submits the query, and if necessary, builds the message to be broadcasted, and sends it. This works fine.
On the other hand the client apps are listening to the UDP broadcast and are actually performing the appropriate task when they receive the message. This is also working.
Now, when I created the Windows Service, which I can successfully register, install, and start (no errors are shown in the Event Viewer), I copied and pasted the Timer’s event handler code as well as the subs and functions that are need, but nothing happens.
When I attach to the process in order to debug it, I can pause it and the Debugger takes me to an assembler address that shows this error message when examined through the Watch tool “CXX0013: error: missing operand”. Does anybody have a clue what could this be?
I copied and pasted the code from the Service into a new Windows Application, and it works!!! Thank you very much for your time and wonderful help.
Alex.
Still a very lost guy
-- modified at 13:49 Thursday 18th May, 2006
|
|
|
|
|
after installing the service go to control panel and open the services. right click on your service and check the logon info. may be the user used for the service do not have rights to perform the required operation.
try to give it admin user and password for testing.
Rizwan Bashir
|
|
|
|
|
I installed the service and have it running using the system account which has full access. I do not get any errors related to the SSPI, nor entries in the Logon details.
thanks for trying. have a nice weekend.
The lost dude!!!
|
|
|
|
|
Hi all,
I have installed my program on my network machine (EXE and the DB)
I have set the sharing & Security for the folder of the network machine
When I try to run the program from my machine I get the following error:
Request for the permission of type
System.Data.SqlClient.SqlClientPermission, System.Data,
Version= 1.0.5000.0, Culture =neutral,
PublicKey Token = b77a5c561934e089 failed
It runs fine from the network machine i.e. If run it from the NETWORK machine.
This is the code for me to open my conection:
Imports System.Data.SqlClient
....
Dim Conn As SqlConnection = New SqlConnection
Conn.ConnectionString = "Data Source=(local);" & _
"Initial Catalog=Rsch1;" & _
"Integrated Security=SSPI"
Conn.Open()
How do I set the permision for the network machine?
Tnx
|
|
|
|
|
Programs run from a network share run with a lower permission than applications run from the local machine. This is because the network share could be a WebDav drive out on the internet, etc.
The first thing is, the connection string won't work from your machine. When your machine runs the code, it will see "Data Source=(local)," and it will attempt to attach to your machine and not the networked machine. Presumably, you want to run against the databse on the network machine. So your connection string needs to look like:
Data Source=SERVER\.;Initial Catalog=Rsch1;Integrated Security=SSPI
Additionally both your machine and the server must be members of mutually trusted domains, or SSPI will fail. If you are in a workgroup, you probably can't use integrated security (SSPI) reliably, but your milage may vary.
Of course, in my version of the connect string, SERVER needs to be either the IP Address of your SQL Server or its machine name -- it shouldn't be the word SERVER unless that happens to be what its name is. Also, you need to make sure that SQL Server is configured to allow remote connections (Surface Area Manager in newer versions configures it for connections from the same machine only by default -- you can change this in your management tool).
Additionally, when you are running from a network share, you lose permissions from the .NET framework. When you run from your local drive, you run at full trust. When you run from a network share, you don't run at full trust. This is a defense mechanism against Worm programs and other attacks.
In control panel, you can use the .NET Configuration Assistance to trust the assembly or publisher. If you are on a corporate network, you want to have a domain administrator update the group policy to allow the executable the necessary permissions. If you are using .NET 2.0, the SDK provides a program that can tell you the exact permissions your application requires.
The tool is named SecUtil, and it usually is in C:\Program Files\Microsoft.NET\SDK\v2.0\bin\secutil -- depending on your install order versus mine, it may be in a different location (I install the SDK, then install Visual Studio -- if you install the SDK as part of Visual Studio, then it ends up under Visual Studio somewhere). There is documentation on the tool on Microsoft's site.
Note that you'll have to adjust the machine configuration or user configuration to trust the assembly -- there is nothing you can do on the network share to trust it. This is a defense mechanism. The best bet, if you are the developer, is to sign the application, and trust that publisher -- that way your network people can push that trust to all your machines that want to run the app, and when you write additional apps, you can just sign them versus having to go through this whole process again.
|
|
|
|
|
Hi,
In vb6, there would be an Option Group control that could contain a set of buttons, or boxes etc.
Values would be assigned to control, and Select Case statements could be created based on the Option Group control.
The only thing I could find in VStudio/VB.net is the groupbox control.
Here is what I have:
<br />
Select Case GroupBox1.Controls<br />
<br />
Case RadioButton1<br />
<br />
MessageBox.Show("button1 selected")<br />
<br />
Case RadioButton2<br />
<br />
MessageBox.Show("button2 selected")<br />
<br />
End Select<br />
For the Case RadioButton1 and 2, I receive a message, "Operator '=' is not defined for types System.Windows.Forms.Control.ControlCollection and boolean...
Any suggestions is greatly apprciated.
Rashar
|
|
|
|
|
You could use somthing like this;
Sub SetControlArray()
Dim Radio(6) as RadioButton
Radio(0) = RadioButton1
Radio(1) = RadioButton2
Radio(2) = RadioButton3
Radio(3) = RadioButton4
Radio(4) = RadioButton5
Radio(5) = RadioButton6
End Sub
Then use a For... Next to do what you want.
Hope this helps.
For every action there is an equal and opposite malfunction
|
|
|
|
|
Hello
I am a newbie VB.NET programmer, still learning the ropes. I would like to be able to have my program get passed the filename/filepath of the current file the mouse cursor is hovering over. For example, in the windows explorer file view window, when the user hovers the cursor over a file named "readme.txt", my program will get the filepath and filename to that file.
Thank you so much for any help!
|
|
|
|
|
Search the internet on Shell Extentions and you'll find lots of code which I guess (as far as I remember) include what you need...
|
|
|
|
|
Hello all
I am having a small problem which I was hoping I could get help with. I am loading a local web page into the webbrowser control (Framework 2.0), and have made the control real small. My goal is to have it sort of look like a large thumbnail of the rendered web page.
The issue I am having is, no matter what size I make the control, the web page itself is always "full size". So with a real small webbrowser control, I end up just seeing a small amount of the upper left corner of the page. I want to see the entire page, just much much smaller. THumbnail sized.
Any help is greatly appreciated.
|
|
|
|
|
I'm going to try to make this simple. I use thunderbird as my email client on my pc. I have written a program that uses MAPI to send a message. I need to test it with Outlook. I set up an email account in outlook that works nicely. I then set the default email client to outlook. But, my program still launches thunderbird. Thunderbird tells me it isn't the default email client and mailto: now uses outlook so I know the default email client has been changed to outlook. It's not my code as in windows explorer if I select a file then right click and select Sendto/Mail recipient it still opens thunderbird too.
I've been searching the web for over a day now and I've read all kinds of stuff about mapi but can't figure out what is going wrong.
It appears the mapistub.dll has replaced mapi32.dll as they are the same size and dates. I think this is normal.
There is no mapi32x.dll on my system anywhere.
In the registry
the default mail client is set to Microsoft Outlook
outlook's dllpath is mapi32.dll
thunderbird's dllpath is c:\progra~1\mozill~2\mozmapi32.dll
I am running Windows XP Pro 2002 SP2, Outlook 2000 Sr-1, Thunderbird 1.5.0.2
I'm hoping someone here can help. Thanks
|
|
|
|
|
The "default mail program" does not impact MAPI -- it is a user setting, while MAPI provider is, unfortunately, a system setting.
First, see if System.Web.Mail will get the job done for you -- if it will do what you need, use it. I have not used it with Thunderbird, so I don't know if it will call through. If System.Web.Mail won't get the job done, then try Collaboration Data Objects (CDO), and verify it won't get the job done. If CDO works, it will be a better choice than MAPI. It gives you an object model, etc. and doesn't require nasty p/Invoke calls.
The MAPI32.DLL switch operates based on these registry keys (source: Platform SDK)
HKEY_LOCAL_MACHINE\Software\Clients\Mail\(default)
HKEY_LOCAL_MACHINE\Software\Clients\Mail\Provider1
HKEY_LOCAL_MACHINE\Software\Clients\Mail\Provider2
HKEY_LOCAL_MACHINE\Software\Clients\Mail\Provider3
Where Provider1, Provider2 and Provider3 are MAPI providers.
Underneath each provider, find the following:
(default) -- this is the display/text name of the provider
DLLPath -- this is the file name (without a path) of the DLL
DLLPathEx -- this should be the fully qualified path
MSI* -- information to do the install
Also check for these registry entries, which can overide the MAPI used for specific applications:
HKLM\Software\Microsoft\Windows Messaging Subsystem\MSMapiApps::exchng32.exe = ""
(route call directly to Mapi32x.dll)
HKLM\Software\Microsoft\Windows Messaging Subsystem\MSMapiApps::msspc32.dll = "Microsoft Outlook"
(route call using Microsoft Outlook key under HKLM\Software\Clients\Mail)
Also, try this (from platform SDK):
In the event that an application overwrites Mapi32.dll, you can restore it using Fixmapi.exe. Fixmapi.exe can be found in the same location as the stub library itself, usually C:\Winnt\System32 for Microsoft Windows NT version 4.0 systems. This utility copies the current Mapi32.dll (the new DLL that overwrote the stub library) to Mapi32x.DLL, and then copies the stub image, contained in the Mapistub.dll file, to Mapi32.dll. There are no arguments for Fixmapi.exe.
If the MAPI DLL was provided by Netscape or Eudora e-mail clients, the DLL is renamed to Nsmapi.dll or Eumapi.dll respectively, and the appropriate HKLM\Software\Clients\Mail subkey and DLLPath value are created. The DLLPath value points to the renamed DLL because neither DLL supports extended MAPI calls, so the DLLPathEx value is not needed.
Again, if at all possible I would go with System.Web.Mail or CDO. These should "do the right thing" and correctly route through Thunderbird or Outlook. If it is not possible to route through these implementations, and you do have to call MAPI directly, then I would probably allow the user to select a provider from the list.
|
|
|
|
|
First, my understanding is that system web mail does not actually open your default mail client but sends the message itself. I'm not sure about CDO. I'm trying to replicate the action of the Send To/Mail Recipient found in Windows Explorer. It's what we want.
As for my MAPI setup everything you spoke of looks correct still it doesn't work.
|
|
|
|
|
Well, I tried uninstalling and reinstalling and recreating the accounts in Outlook and I still can't get Outlook to come up when I select Send To/Mail Recipient. Let make this even simplier. Just get me that. I don't want to program anything any more. I want to make Send To/Mail Recipient bring up Outlook. Can anyone tell me how?
|
|
|
|
|
Dave Bacher wrote: The "default mail program" does not impact MAPI -- it is a user setting, while MAPI provider is, unfortunately, a system setting.
Apparently it does. I'd tried changing the default mail program using use Start/Settings/Control Panel/Internet Options many times and it didn't work. But after I used the "Set Program Access and Defaults" icon, located in the Start menu somewhere and in the "Add or Remove Programs" tool in Control Panel to set the default mail program to--as Outlook wasn't an option--Outlook Express things started working.
Now using Start/Settings/Control Panel/Internet Options I can change my "default mail program" and the mail program launched by my vb program via mapi changes as does the mail program launched by Send To/Mail recipient in windows explorer. I haven't been in "Set Program Access and Defaults" since. Just use Start/Settings/Control Panel/Internet Options. I've changed it from Outlook to Thunderbird and back several times w/o rebooting or even closing my application and whatever I select as my default mail program is the mail program that is started when I click the button to send mail in my program.
Why this works and why it wasn't I don't know but my experiences clearly show changing the default mail program in Start/Settings/Control Panel/Internet Options will change the mail program started by mapi (at least as it is used in my sub). Further my experiences strongly suggest that microsoft uses mapi the same way as I do in their windows explorer send to/mail recipient functionality.
Anyway, thanks for the help and I'm working good now.
|
|
|
|
|
Please email me at Sterling.wright@comcast.net
I am trying to undo a range in excel. However, I can't get the script to work. I want to add in funcationality to undo a specificied range. I tried Application.Undo. But, it only resets Cell D106.
Please See Script Below
Private Sub CommandButton1_Click()
Dim Config As Integer
Dim Ans As Integer
Dim MaxVal As Integer
Dim UserEntry As String
Dim Msg As String
Dim DblEntry As Double
MaxVal = ActiveSheet.Range("D107")
UserEntry = ActiveSheet.Range("D106")
If UserEntry > MaxVal Then
Config = vbCritical + vbQuestion + vbDefaultButton2
Ans = MsgBox("Are you sure you want to use more hours than you are budgeted?", Config)
End If
End Sub
|
|
|
|
|
Sir,
I am displying images into the img tag in datalist control.Now the problem is when I acces the images from the database and showing the images into datalist ,there lies no difference in portrait and landscape images.I mean in the img tag in the datalist control i am mentioning the height and width.so both images either show themselves portrait or landscape.If i don't mention the dimensions(height and width) then some pictures coved one and a half page and som 2.Do I have to mention the height and width of the img tag in datalist control at runtime.If so how to do it.
Please sort out the problem
If possible please send the project with solution file.
Thanks and Regards
Amaneet Brar
|
|
|
|
|
Hi,
yes you can set the properties of that at the runtime in the OnItemDataBound event of the datalist. If you are know it that whether the image is landscape or portrait then depending upon the condition it can be set.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Sir,
I am using the update query and there is occuring the problem
There is a syntax error in update command.
Please sort out the problem
Thanks and Regards
amaneet Brar
str = "Provider = Microsoft.jet.Oledb.4.0;Data Source =" + Server.MapPath("\sandeep\sujok\sujok.mdb")
con = New OleDbConnection(str)
con.Open()
Dim sdd As String = "Update admin Set password ='" & txtNewPassword.Text & "' where user_id = 'ddd' and password = 'aa'"
cmd = New OleDbCommand(sdd, con)
cmd.ExecuteNonQuery()
con.Close()
-- modified at 8:51 Thursday 18th May, 2006
|
|
|
|
|
You are injecting text directly into your SQL string. This can compromise the security of your database and your application. You should, at least, use parameterised queries. See SQL Injection Attacks and Tips on How to Prevent Them.[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
|
I am going to using DSOFILE.dll in my application.
It is a free component provided by Microsoft, but I find most of client doesn't have this component.
For easy maintainance, I hope this component can embed to my application.
How can I do that? I don't wanna use shell() actually.
Thank you friends.
|
|
|
|
|