| Handling shutdown in windows vista |
|
 |
Index ‹ Visual Studio ‹ Visual Basic [VB]
|
- Previous
- 1
- MFC >> how to use invalidate and validateI am using DrawRectangle and SetPixel and some other drawing functions over
an image displayed in the background. I'm wondering what exactly I should be
doing to make sure that when my application regains focus that things were
like they were when focus was lost. I'm not quite sure what the Validate
functions do, which is part of the problem.
--
to reply, remove Big10 from address
- 2
- Visual Basic [VB] >> dataGrid & dataGridViewhi, all
In VB 2005 Beta i cant find dataGrid control in the toolbox, instead
DataGridView is available.
What is the differance between the two ?
How can i get dataGrid Control?
Thanks
irfan
- 3
- Visual Studio C++ >> PictureBox Owner Draw Win32How to make an owner drwan Picture Box in ATL ( not using MFC support). My
aim to make the picture transparent in the dialog.
I am using ATL composite control dialog. But in the Picture Control, there
is no Owner draw property listed in Property Window. I manuall modified rc
file and add SS_OWNERDRAW, But i am not gettiing the WM_DRAWITEM message....
I did try to set owner draw
::SetWindowLong( ::GetDlgItem( m_hWnd, IDC_STATIC_PIC ), GWL_STYLE,
(::GetWindowLong(::GetDlgItem( m_hWnd, IDC_STATIC_PIC ), GWL_STYLE ) )|
SS_OWNERDRAW );
also by SendDlgItemMessage()
Since the I am not getting WM_DRAWITEM to my ATL dialog, i cant do anything
to make picture box the transparent.
Any suggestion , code are welcome
Thanks
- 4
- VB Scripts >> Replacing Shut Down...I think I may have originally mis-posted this message to the wrong newgroup
Does anyone know if I could replace the "Shut Down..." button in the Start menu with a my own shortcut that points to a VBScript that will restart the computer? If so, how do I do it?
What I need to do is prevent the user from being able to shutdown the PC. With the NoClose option, the user also loses the capability to restart the PC which we would like them to have. I have to provide a script that will give them that option. I would like to have the "Shut Down..." button run my script
Thanks in advance
Rus
- 5
- Visual Studio C++ >> Is overriding a function of a library in accordance with C++ standard?Is overriding a function of a library in accordance with C++ standard?
The following code is passed by the VS 2005 and Dev C++.
#include <cstdlib>
#include <iostream>
using namespace std;
size_t strlen(const char* p)
{
return 0;
} // !!! Note this !!! The standard library function strlen is
deliberately overriden.
int main(int argc, char *argv[])
{
system("PAUSE");
return EXIT_SUCCESS;
}
There is even no warning after compiling the code. In front of the
fact, I have to make a guess that all the C++ compilers are conformed
to the following rules:
1) The compiler first compiles all the source file included in the
project into object files;
2) At link time, the compiler first searches the object files for all
the unresolved symbols; if it fails to find some symbols, then the
compiler will search the libraries which are included in the project to
find the symbols.
3) If the object files containes a symbol, then the symbols that have
the same name in the libraries will be ignored.
Am I correct?
Any help will be appreciated. Many thanks in advance.
- 6
- 7
- Visual Basic [VB] >> User Control Property Defaults QuestionI created a user control. It has a text box in it. Everything works
fine. However, when I place my control on a form, many of the
properties are already in bold. This is supposed to mean that
something other than the default was chosen for those properties. But
that is not correct. The properties are set to their "default" value.
Example of my code for one property:
<Browsable(True),
DefaultValue(System.Windows.Forms.BorderStyle.Fixed3D),
Description("Indicates whether the EnhancedTextBox will have a
border.")> _
Public Overloads Property BorderStyle() As
System.Windows.Forms.BorderStyle
Get
Return TextBox1.BorderStyle
End Get
Set(ByVal value As System.Windows.Forms.BorderStyle)
TextBox1.BorderStyle = value
End Set
End Property
I have my "DefaultValue" set for this property. And when I place a
new instance of this control on a form, the BorderStyle is Fixed3D,
but it shows in the Properties Window in bold. Why? And how do I fix
this? This property is also in the Designer code of the form I placed
the control on and it should not be. I thought that default values of
properties are not supposed to be in the Designer code.
- 8
- Visual Basic >> Unloading an application from the system tray menuI use a system tray icon for my application, that found from:
http://www.mvps.org/vbnet/code/subclass/shellnotifybasic.htm
In this system tray program if we want to close the application
from the system tray menu we must use the :
Call PostMessage(Form1.hWnd, WM_CLOSE, 0&, ByVal 0&)
This WM_CLOSE message is equal to vbFormControlMenu in
a QueryUnload or Unload Event.
But in my application I have at the QueryUnload Event :
If UnloadMode = vbFormControlMenu Then
Cancel = True
Form1.WindowState = vbMinimized
Exit Sub
End If
The article of the above system tray icon program, says that
we have a GPF if we try to close the application with an
Unload.Me Statement. I tried this and I didnt saw any GPF...
Thereby I use the Unload.Me Statement to close my application
from the system tray icon's menu, because the WM_CLOSE
message, simply minimize the application.
If I have two or three open Forms and the user press "Exit"
from the system tray, then i have to put in the code the :
Dim n As Integer
For n = Forms.count To 1 Step -1
Unload Forms(n - 1)
Next
and then when I have a modal Form opened after this code,
I have to write at the after the "Form3.Show vbModal" clause,
the :
If Forms.count = 0 Then Exit Sub
My question is if with this way all the forms unloaded from
the memory, or there is another way to exit from my application
from the system tray icon menu.
- 9
- Mcse >> Question on CLI (Exam 70-290)Hi-
How many Command Line Question can I expect in the above
Exam. Also what is the Total Number of Question being
Asked.
Secondly I am following MS CTEC CourseWare from NIIT
(Course 2273B) - This is pretty consice and I am very
comfortable with it. Is this enough for the exam or Do I
need to refer to other MS Press Books.
Regards
- 10
- VB Scripts >> Edit user profile with scriptIm using a script to put a logon script on my users in Active Directory. But
the script can only edit one user (cn=username). How can i use it to edit
all the users in a OU instead of only the one user?
The Script:
-----------------------------------------------------------------------------------
Set objUser = GetObject _
("LDAP://cn=username,ou=it,ou=auning,ou=windows,ou=datagraf,dc=datagraf,dc=dk")
objUser.Put "scriptPath", "vplogon.bat"
objUser.SetInfo
-----------------------------------------------------------------------------------
Jesper S.
System Administrator
Datagraf Auning
Denmark
- 11
- Mcse >> AMCNGP: Examples from MCNGP (making people angry)"> >>Every time I frequent this news group, I am left feeling truly horrified
> >>by the abusive attacks on people who are so generously offering their
> >>help to others"
http://www.freenfo.net/en/exam-mcse/278467-mcngp-thugs-9.html
--
fmsmcse
AMCNGP#2
--------------------
MCNGP gAys are not the know it all!!!
- 12
- MFC >> CDialog creation in codeHi
Can someone point me at some example code, or post a basic example,
for producing Dialogs in code, not using DLGTEMPLATE? I know this
is unusual but it would be the most convenient way for porting some code.
I need to create both modal and modeless dialogs.
- 13
- Visual Basic [VB] >> delete file problemi try to print image file in a directory using PrintDocument. It will raise
printPage event to draw image to the printer. The file will be deleted
after print and the directory will be checked every second to get new file
inside it.
Where should i do the delete function? The way to print image is get from
msdn. Can tell me where can i refer to other better ways to print the
image file.
Thank you.
Public fileName As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
End Sub
Sub printImage(ByVal fileName As String)
Dim pd As New PrintDocument
AddHandler pd.PrintPage, AddressOf Me.pd_PrintPage
pd.Print()
End Sub
Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As
PrintPageEventArgs)
' Draw a picture.
ev.Graphics.DrawImage(Image.FromFile(fileName),
ev.Graphics.VisibleClipBounds)
' Indicate that this is the last page to print.
ev.HasMorePages = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Dim dir As New DirectoryInfo("c:\dir")
Dim fi As FileInfo() = dir.GetFiles()
Dim fitemp As FileInfo
For Each fitemp In fi
fileName = fitemp.FullName
printImage(fileName)
Next
End Sub
___
Newsgroups brought to you courtesy of www.dotnetjohn.com
- 14
- VB Scripts >> Determine if a file is openUsing Office 2003 and Windows XP;
Is there a way using a script (in a VBS script file) to determine if a file
is open?
If so, could someone please post example code?
Thanks much in advance.
- 15
- MFC >> Windows/MFC bug with TOOLTIPS??I'm not sure if this bug is in MFC or with the tooltip common control, but
I have an MFC application with tooltips enabled for the toolbar. I'm "owner
drawing" the tooltips, but I'm having this problem:
Button1 Button2
the tooltip for Button1 is "AAAAAA"
the tooltip for Button2 is "ZZZZZZZ"
On a "slower" machine (1.6ghz), I mouse over button1 and "AAAAAA" pops up
just fine, then I mouse over button2 and I see "AAAAAA" moved over button2
for a second before it updates itself to "ZZZZZZZ". What I mean, is that I
see the old tooltip moved over to the new location flash before the tooltip
updates.
It even happens on standard tooltips.
Seems like something weird, because if I put a "Sleep(100);" in the WM_PAINT
handler, I can see the window moved over (with the old tooltip intact). Like
windows is caching something. Normally if you put a Sleep(100) in the
WM_PAINT handler and the window is hidden/shown like a tooltip, I would
expect the window underneath to show through, but it doesn't in this case...
the window is shown like its being painted somehow.
I've tried the normal tricks with UpdateWindow(), SetWindowRgn(),
WS_VISIBLE, etc... but I can't figure out a way around this...
Any ideas?
|
| Author |
Message |
linesider49

|
Posted: Wed Dec 19 04:57:24 CST 2007 |
Top |
Visual Basic [VB] >> Handling shutdown in windows vista
Hi,
How can I abort the shutdown/logoff in windows vista?
Using the WM_QUERYENDSESSION only works in XP.
TIA
Carlos
Visual Studio43
|
| |
|
| |
 |
Claes

|
Posted: Wed Dec 19 04:57:24 CST 2007 |
Top |
Visual Basic [VB] >> Handling shutdown in windows vista
This might help:
http://msdn2.microsoft.com/en-us/library/ms700677.aspx
/claes
<EMail@HideDomain.com> wrote in message
news:EMail@HideDomain.com...
> Hi,
>
> How can I abort the shutdown/logoff in windows vista?
> Using the WM_QUERYENDSESSION only works in XP.
>
> TIA
>
> Carlos
|
| |
|
| |
 |
| |
 |
Index ‹ Visual Studio ‹ Visual Basic [VB] |
- Next
- 1
- Mcse >> Design ExamsI have one more exam to complete before im MCSE W2K... and
its one of the design exams. I've heard the 220 exam is
four hours long... which seems a little daunting! I asked
at my local test centre and they suggested 70-219. I dont
seem to hear much about 70-221... is that because everyone
has been put off by 70-216? Anyone out there got any
advice on the design exams for me (and any books you can
suggest would be helpfull)
Cheers,
Ant
- 2
- VB Scripts >> Regular Expression Replace : $1 shows up as literal.Hi There.
I have searched the news groups and cannot seem to find an answer to my
situation. Basically, I have the following function (that appears
standard across all posts):
Public Function Highlight(p_sFind, p_sSearch)
Dim RegEx
Set RegEx = New RegExp
RegEx.Pattern=p_sFind
RegEx.IgnoreCase=True
RegEx.Global=True
Highlight = RegEx.Replace(p_sSearch,"<b>$1</b>")
End Function
However, wheneven I execute it on some code, I get a literal "$1"
rather then the string I searched for.
For example, Highlight ("Harv", "Harvard Medical School") returns:
"<b>$1</b>ard Medical School" rather than "<b>Harv</b>ard Medical
School".
Does anyone have any idea what I am doing wrong. Is any server
requirements in using this tool?
Thanks
Jason
- 3
- MFC >> Max Text for CEdit ?Hi guys,
I tried pasting a lot of characters into a CEdit but it got truncated and I
couldn't type anything else in. It wasn't a huge amount of characters, just
source from a web page that can easily be viewed in Notepad.
What's going on ? Can I fix it ?
Thanks,
Robert
- 4
- MFC >> Write Text on an imageHi
i've made an application that writes some text on an image..so far i've only
been able to write in english..does anyone know if TextOut() method of CDC
support text in languages other than english..
Regards
Usman Jamil
- 5
- VB Scripts >> Filename with date modified appended to filenameneed to find a way to change filenames that relect the filename and
the date modified. I have found numerous ways to get the current date
and time appended to the filename but nothing with date modified. I
have users that need to have this in the filename and I am in search of
some help in this matter. Example is a file named test.txt with a date
modified 1/31/2005. I would like the filename to be test
(1/31/2005).txt. Thanks in advance ...
- 6
- Visual Basic [VB] >> Reliable conversion from byte() to string WITHOUT use of System.Text.EncodingThe reason I want to do so, is that I am sending to DOS and I am pretty
certain that it will not work.
Everything I've tried so far hasnt.
In my test environment (Windows to Windows) this works perfectly, but not
when sending to DOS:
Private Function bytearray2string(ByVal input As Byte()) As String
Dim output As String
output = System.Text.Encoding.Default.GetString(input)
Return output
End Function
Private Function string2bytearray(ByVal input As String) As Byte()
Dim output() As Byte
output = System.Text.Encoding.Default.GetBytes(input)
Return output
End Function
I have also tried this, to no avail in Windows:
Private Function bytearray2string2(ByVal input As Byte()) As String
Dim output As String = ""
Dim i As Integer = 0
'Dim vchar As Char
While i < input.Length
output = output & CChar(Chr(input.GetValue(i)))
i = i + 1
End While
Return (output)
End Function
Private Function string2bytearray2(ByVal input As String) As Byte()
Dim output(input.Length - 1) As Byte
Dim i As Integer = 0
For i = 0 To UBound(output)
output(i) = CByte(Asc(input.Chars(i)))
Next
Return (output)
End Function
The desired functions need to use no encoding and be able to work with
simple bytes. The values I'll be receiving wont be higher anyway.
I'd appreciate any feedback whatsoever.
regards,
J
- 7
- Visual Basic >> re: printing certain pagesHi
I am trying to print certain pages from a textbox.I can all print pages but
i need to know how to print any page or pages i want to.
Does anyone know where i can start or have a sample of code.
Many thanks
Garry
- 8
- Visual Basic [VB] >> Business Layer and Data Layer application blocksHi,
A doc about a set of components I named as "Business Layer and Data Layer
application blocks" is available at
http://www.sabbasoft.com/myBlog/PermaLink.aspx?guid=070a8c55-b885-4b89-8f3a-a23801fb732e
You might be interested in reading it to get new ideas for your development
process.
As return I'll appreciate if you post me back any comment you might have
regarding this doc.
Best Regards
--
Enrico Sabbadin
Mail: sabbadin@sabbasoft.com
Website: http://www.sabbasoft.com
********
MTS - COM+ - VBCOM - Enterprise Services - Security FAQ
.NET & COM+ books selected list
********
Blog: http://www.sabbasoft.com/myblog
Affiliated Sites
http://www.vb2themax.com
http://www.codearchitects.com
- 9
- MFC >> Remote Desktop does not show system tray icon.My program is a service that runs on Windows Server 2003. The program displays a system tray icon
that seems to work fine when viewed from the PC's monitor. However, if I access the PC remotely
using Remote Desktop the icon does not appear. Many other icons appear, but not mine.
Using task manager, my program is running "SYSTEM".
NOTE: My program already handles TaskbarCreated for the case where explorer crashes.
Any ideas?
- 10
- Visual Basic [VB] >> LoopI need to loop through a index change event, however whenever i loop
through the first combo box always report back correctly its when i
move to the next combobox, that instead of changing the second combo
box it will change the background of the first combo box.
What im i doing wrong?
For intloop = 0 To cboArraylist.Count - 1
If (CType(cboArraylist(intloop), ComboBox).Text) = "Go"
Then
CType(cboArraylist(intloop), Object).BackColor =
Color.LawnGreen
ElseIf (CType(cboArraylist(intloop), ComboBox).Text) = "No
Go" Then
CType(cboArraylist(intloop), Object).BackColor =
Color.Tomato
End If
Next
- 11
- 12
- Visual Basic >> VB5 Recent MenuI'm using VB5 and I would like to clean the VB5 recent menu.
There are some applications which I have deleted but their names still stay
in the menu.
Is there any way to clear the recent menu? Or maybe remove individual
entrys?
Thanks in advance!
Steven
- 13
- 14
- Visual Basic >> Controlling ProductVersionHello - In VB.NET, how do I control product version, and access it for
reporting on my splash form? This is a simple .exe solution with a project
built out of a few forms and modules, and contains a setup project.
My vbproj file contains ProductVersion = "7.10.3077" . When I report
Application.ProductVersion, its value is 1.0.1723.16260 so clearly that
comes from somewhere else. Anyway, I don't want either of these values.
I would like to set the product version to 1.1.0, and report 1.1.0.build# .
So I'm looking for advice on how to set the value, and how to access it at
runtime.
Thanks in advance -- Dick Bixler
- 15
- Visual Basic [VB] >> mysql date formathi, anyone know how to retrieve date from mysql database? i am using odbc
connection. which reader.getXXX shall I use? for example, my date in mysql is
2005-04-01. i have tried using reader.getstring, reader.getdate but all still
fail. If I use a getstring, it return "dd". (funny). using getdate returns
runtime error.
thanks in advance.
|
|
|