Click here to Skip to main content
15,915,513 members
Home / Discussions / Windows Forms
   

Windows Forms

 
AnswerRe: Calling Form from UserControl Layer Pin
DaveyM691-Jul-09 22:51
professionalDaveyM691-Jul-09 22:51 
QuestionProblem with sizing an image to fit drawn text Pin
Alan Burkhart30-Jun-09 19:21
Alan Burkhart30-Jun-09 19:21 
QuestiongetModuleFileNameEx Pin
johnl012930-Jun-09 5:38
johnl012930-Jun-09 5:38 
AnswerRe: getModuleFileNameEx Pin
DaveyM6930-Jun-09 6:14
professionalDaveyM6930-Jun-09 6:14 
GeneralRe: getModuleFileNameEx Pin
johnl012930-Jun-09 8:11
johnl012930-Jun-09 8:11 
GeneralRe: getModuleFileNameEx Pin
Luc Pattyn30-Jun-09 8:28
sitebuilderLuc Pattyn30-Jun-09 8:28 
GeneralRe: getModuleFileNameEx Pin
johnl012930-Jun-09 8:40
johnl012930-Jun-09 8:40 
GeneralRe: getModuleFileNameEx Pin
DaveyM6930-Jun-09 10:22
professionalDaveyM6930-Jun-09 10:22 
I don't know why it doesn't work for you. I haven't used VB for a long time but I opened up a ne VB WinForms project and did this and it works fine - the Form's Text displays the path.
Imports System.Runtime.InteropServices
Imports System.Text

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
        Text = GetPathOfThisProcessExe()
    End Sub
    Private Function GetPathOfThisProcessExe() As String
        Dim builder As New StringBuilder(500)
        GetModuleFileNameEx(Process.GetCurrentProcess().Handle, IntPtr.Zero, builder, 500)
        Return builder.ToString()
    End Function
    <DllImport("psapi.dll")> _
    Private Shared Function GetModuleFileNameEx( _
    ByVal hProcess As IntPtr, _
    ByVal hModule As IntPtr, _
    <Out()> ByVal lpFilename As StringBuilder, _
    ByVal nSize As Integer) As UInteger
    End Function
End Class
[Edit] Fixed code formating [/Edit]

Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
Why are you using VB6? Do you hate yourself? (Christian Graus)

GeneralRe: getModuleFileNameEx Pin
johnl012930-Jun-09 11:04
johnl012930-Jun-09 11:04 
GeneralRe: getModuleFileNameEx Pin
DaveyM6930-Jun-09 11:17
professionalDaveyM6930-Jun-09 11:17 
GeneralRe: getModuleFileNameEx Pin
DaveyM6930-Jun-09 10:29
professionalDaveyM6930-Jun-09 10:29 
Questionhow to create a new printer and add to the list Pin
genius_palli30-Jun-09 2:10
genius_palli30-Jun-09 2:10 
AnswerRe: how to create a new printer and add to the list Pin
Dave Kreskowiak30-Jun-09 3:40
mveDave Kreskowiak30-Jun-09 3:40 
AnswerRe: how to create a new printer and add to the list Pin
Sk9330-Jun-09 5:04
Sk9330-Jun-09 5:04 
AnswerRe: how to create a new printer and add to the list Pin
genius_palli30-Jun-09 19:21
genius_palli30-Jun-09 19:21 
AnswerRe: how to create a new printer and add to the list Pin
genius_palli30-Jun-09 21:34
genius_palli30-Jun-09 21:34 
GeneralRe: how to create a new printer and add to the list Pin
genius_palli10-Jul-09 2:54
genius_palli10-Jul-09 2:54 
GeneralRe: how to create a new printer and add to the list Pin
Sk9327-Jul-09 23:46
Sk9327-Jul-09 23:46 
Questionhow to use the expandable and collapsable property Pin
honey.rpk29-Jun-09 0:36
honey.rpk29-Jun-09 0:36 
AnswerRe: how to use the expandable and collapsable property Pin
DoctorMick29-Jun-09 5:37
DoctorMick29-Jun-09 5:37 
AnswerRe: how to use the expandable and collapsable property Pin
Rob Smiley30-Jun-09 11:49
Rob Smiley30-Jun-09 11:49 
QuestionHow to make a control as a child to user control but not for a form? Pin
honey.rpk28-Jun-09 21:11
honey.rpk28-Jun-09 21:11 
AnswerRe: How to make a control as a child to user control but not for a form? [modified] Pin
BillWoodruff28-Jun-09 23:20
professionalBillWoodruff28-Jun-09 23:20 
AnswerRe: How to make a control as a child to user control but not for a form? Pin
dan!sh 29-Jun-09 0:03
professional dan!sh 29-Jun-09 0:03 
GeneralRe: How to make a control as a child to user control but not for a form? Pin
honey.rpk29-Jun-09 0:57
honey.rpk29-Jun-09 0:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.