|
The short answer is you can't! The long answer is to write your own MsgBox function.
RageInTheMachine9532
|
|
|
|
|
i want suggestions for my major project which i have to make in my 4th year of engineering.
I will be very grateful if u can suggest something which is very good and a good learning experience.
PLEASE HELP!!!
Every problem has a solution!
|
|
|
|
|
Hello all..
How to get the icon that is associate with the file?
I have email item... which contain file attachments..
So first get the file attachment using mail.Attachments and mail.Attachment. Up to here no problem..
here the code to get the icon and saving it in C:\PCKM so I can call the image file from HTML code
<br />
Function GetIconLocation(ByVal filename As String) As String<br />
Dim loc As String<br />
'Use this to get the small icon.<br />
Dim fName As String 'The file name to get the icon from.<br />
Dim shinfo As SHFILEINFO<br />
shinfo = New SHFILEINFO<br />
Dim openFileDialog1 As OpenFileDialog<br />
openFileDialog1 = New OpenFileDialog<br />
Dim hImgSmall As IntPtr 'The handle to the system image list.<br />
<br />
hImgSmall = SHGetFileInfo(filename, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_ICON Or SHGFI_SMALLICON)<br />
Dim hIcon As Icon<br />
hIcon = Icon.FromHandle(shinfo.hIcon)<br />
<br />
Dim bip As System.Drawing.Bitmap<br />
bip = hIcon.ToBitmap()<br />
bip.Save("c:\pckm\icon.bmp")<br />
loc = "<img src=""c:\pckm\icon.bmp""><br>" & filename<br />
<br />
GetIconLocation = loc<br />
End Function<br />
After I saved the icon.bmp I try to open it by double clicking the file or using open with to oen the file but can't open with any other programs
How to save the icon to the hard drive???
Thank you
|
|
|
|
|
Hello.. all
I used outlook to get the messages (mailItem) and then get the file attachments by calling
mailItem.attachments.attachment
So far no problem.. I got the attachment file name. still no error..
Here the problem come..
how to get the attachment icon?? I used the following code (SHGetFileInfo) to get the file attachment icon location
so I can print the file attachment name with its associate icon on the paper ( same as printing from the printer) using HTML Code
for example:
str = "<img src=""c:\this\is\icon\location\attachmentIcon.ico""><br>"_<br />
& aAttachment.Name
here is my code to get the icon location... This code doesn't work as I want ( I want to get the directory of the image of icon or attachment icon and put it in the html code)
<br />
Dim loc As String<br />
'Use this to get the small icon.<br />
Dim fName As String 'The file name to get the icon from.<br />
Dim shinfo As SHFILEINFO<br />
shinfo = New SHFILEINFO<br />
Dim openFileDialog1 As OpenFileDialog<br />
openFileDialog1 = New OpenFileDialog<br />
<br />
Dim hImgSmall As IntPtr 'The handle to the system image list.<br />
<br />
hImgSmall = SHGetFileInfo(aAttachment.Name, 0, shinfo, Marshal.SizeOf(shinfo), _<br />
SHGFI_ICON Or SHGFI_SMALLICON)<br />
<br />
<br />
loc = "<img src=""" & shinfo.szDisplayName & """><br>" & filename<br />
Thank You
|
|
|
|
|
How do i write a program that it use randomize to generate 2 postives number and sum them up. There are four choices for user to choose, this four choices are also generate from randomize. Question and answer generated should be between 1 to 100.
|
|
|
|
|
Random r = new Random(DateTime.Now.Second); //initalize the generator
//generate two integers between 1 and 50
int number1 = r.Next(49)+1;
int number2 = r.Next(50);
//sum up the numbers - result cannot be <1 or >100
int sum = number1 + number 2;
//generate more numbers...
What do you need this for, is it homework?
|
|
|
|
|
Sorry, I posted that in C#. Here is VB:
Randomize (Timer)
Dim number1, number2, sum As Integer
number1 = (Rnd() * 49) + 1
number2 = (Rnd() * 49) + 1
sum = number1 + number
|
|
|
|
|
I just started learning the vb.net and I would like to know how can I check if a subkey exists in the registry and use a code to create the subkey it if does not exist in the registry.
All help will be welcome.
Thank you,
Simon
|
|
|
|
|
There is an example of this very topic on the samples for VB.NET:
Private Sub DoesKeyExist
Dim regVersion As Microsoft.Win32.RegistryKey
regVersion = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\TestApp\\1.0", True)
If regVersion Is Nothing Then
regVersion = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("SOFTWARE\\Microsoft\\TestApp\\1.0")
End If
End Sub
This will check to see if a key exists, then if not, creates it.
Oh yeah! It also needs a reference to the Win32 namespace.
RageInTheMachine9532
|
|
|
|
|
I am using VB.net I am looking for a way to export a registry key like
HKLM\System\CCS\Control\Services (the whole key and all subkeys).
I would like to use the same methods that Regedit uses.
BTW: I am connecting to a remote machine's registry.
Question #2.
How do I determin the data type of a registry key. I understand how to read the value name and value but not the data type.
Example.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update
Value: AUState
Data Type: Reg_Dword <----This is what I am looking to discover.
Data: 2
Louis
|
|
|
|
|
wobblervb wrote:
I am using VB.net I am looking for a way to export a registry key like
HKLM\System\CCS\Control\Services (the whole key and all subkeys).
I would like to use the same methods that Regedit uses.
It looks like RegEdit has its own enumerator built in. There is no function in the .NET framework that does the exact samething, so it looks like your going to have to write your own exporter.
wobblervb wrote:
How do I determin the data type of a registry key. I understand how to read the value name and value but not the data type.
The .NET framework doesn't offer a function to do what your want. Your probably going to have to write a C++ component to return that info.
RageInTheMachine9532
|
|
|
|
|
I want to use SendMessage to send a WM_UPDATEUISTATE message that I hope will show the focus rectangle on option buttons but I cannot find the constant values for the expected wParam values: UIS_CLEAR, UIS_INITIALIZE, UIS_SET, UISF_HIDEACCEL, UISF_HIDEFOCUS, UISF_ACTIVE.
I know that I can change a setting in the Control Panel (Display - Appearance - Effects) but I want to be able to control this programmatically.
Any ideas?
|
|
|
|
|
If I read this right, you just want to move the input focus to a button control. In VB.NET, that's easy:
controlName.Focus()
will set the focus to that control. BUT!! (There's always one of these!)
Long version:
A control cannot receive focus unless it is enabled, is visible, AND HAS A WINDOW HANDLE ASSIGNED TO IT! What this means is, you can only set the focus to the control AFTER it has actually been created and it's Message Loop is up and running.
Short version:
If you try and set the focus to a control in a Form's Load event, you must first Show() the form, THEN set the focus to the control. Otherwise it won't work.
RageInTheMachine9532
|
|
|
|
|
RageInTheMachine9532 wrote:
you just want to move the input focus to a button control
Thanks for the reply, but no. What I want to do is tell Windows to show a focus rectangle around the text of a button that has input focus. By default in XP it does not. Also, I am using VB6, not .Net.
If you search MSDN for the WM_CHANGEUISTATE Message you'll see exactly what I'm talking about.
On the other hand, if you have .Net and you search your local help file for the UIS_ and UISF_ constants specified in this tread's header, might you be able to tell me the numeric value of these constants?
For example, I know that...
WM_CHANGEUISTATE = 295 (H&0127)
WM_UPDATEUISTATE = 296 (H&0128)
WM_QUERYUISTATE = 297 (H&0129)
...but I do not know the value for these other constants and they are not known by VB6 because it pre-dates their use in the operating system (beginning with Win2000).
|
|
|
|
|
OK. I think I understand what your trying to do now.
I found the constants in WinUser.h in the VC98\Include folder. Here is the copy/paste:
#define UIS_SET 1
#define UIS_CLEAR 2
#define UIS_INITIALIZE 3
#define UISF_HIDEFOCUS 0x1
#define UISF_HIDEACCEL 0x2
#if(_WIN32_WINNT >= 0x0501)
#define UISF_ACTIVE 0x4
#endif /* _WIN32_WINNT >= 0x0501 */
#endif /* _WIN32_WINNT >= 0x0500 */
#endif
RageInTheMachine9532
|
|
|
|
|
Rage,
Thanks a bunch. That is exactly what I was looking for. Unfortunately, my winuser.h file does NOT include these constants and frankly I don't know why (VB6 Enterprise).
I'll track that issue down next.
|
|
|
|
|
Puchinello wrote:
Unfortunately, my winuser.h file does NOT include these constants and frankly I don't know why
Download the latest Platform SDK.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Good gumba gumba! The whole SDK will take over 10 hours to download on my 56K! I'll spring 10 bucks for the CD by mail.
Thanks for the insight!
|
|
|
|
|
Anyone know how to grant a user account "Logon As Service" rights through VB/VBScript?
I'm trying to pre-install a couple of services, and although I have managed to get the WMI scripts working to create and run the services as the account in question, I cannot figure out how to grant the account logon rights without having to revert to using the old NTRIGHTS util.
Target OS are XP/2K, they are running both Stand-alone, on NT Domain or an Active Directory.
Meanwhile ... i will have to wsshell ntrights :-<
Cheers
Alun Boyd
|
|
|
|
|
I don't know how to do it off the top of my head, but the first question I have is: Is the .MSI being elevated to Admin level when it's run? Without this, you can't modify any use to Logon As Service.
RageInTheMachine9532
|
|
|
|
|
My mistake, I should of mentioned that this is a straight VBS task (to be VBE'd later), and will be run from an Local Admin account.
Being a bit of a newbie to VB, I don't particually want to start fiddling with MSI just yet, it seems to be a bit OTT for the current purpose.
I have sort of found 2 ways around this. The first is to use NTRIGHTS.EXE but this means ensuring it's avaliable and that it can lookup the SID of the account that will require the rights. Unfotunatly this is not always possiable as it's a domian account that needs rights, and the service may need installing off-network (and NTRIGHTS won't take a SID as an argument).
The other method is to create on-the-fly a simplified Security Template then run "secedit /config /areas USER_RIGHTS ....." to apply the template. The only problem is if other user's have been given rights, the template wipes them out :-<
|
|
|
|
|
I haven't been able to find any scripting that will modify the Rights of a User Account. But, I can tell you that it is possible to do and it WILL require WMI to do it. Lucky for you W2K and XP both come with it native. 95/98/NT4 doesn't support WMI without first installing it seperately.
I'm still looking for a scripting solution...
RageInTheMachine9532
|
|
|
|
|
Thanks for looking Rage, I can only assume you too are flummoxed!
I'm probably going to have to fall back on the security template method, assuming i can get 'secedit /export' to work so that I incorporate any previous security rights in the newly modified ones.
|
|
|
|
|
how will i optimize the use of methods Finalize and Dispose? when to use Finalize instead of Dispose or vice versa? when to use both of them?
... i have read my references bout this but im not sure with my 'interpretation' of the lecture.
. tnx guys.
.. here we go again.
|
|
|
|
|
Im a newbie when it comes to .Net technologies. Right now I am developing an MDI application using VB.Net. So this is my first .NEt project.
first question:
... why is that when the child form is being closed using the control menu (control box), the next time i click the menu item that should make the child form show up again, it won't show anymore?....
here's the code behind the menu item:
Private Sub mnuRR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuRR.Click
If RRChild Is Nothing Then
RRChild = New frmReceivingOrders(Me)
End If
RRChild.Show()
End Sub
* RRChild is the child form
* mnuRR is the menu item of the parent form
... tnx
.. here we go again.
|
|
|
|