Click here to Skip to main content
15,887,083 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Problem in thread (VB.Net 2005) Pin
priyamtheone23-Jun-09 3:10
priyamtheone23-Jun-09 3:10 
AnswerRe: Problem in thread (VB.Net 2005) Pin
Dave Kreskowiak17-Jun-09 8:06
mveDave Kreskowiak17-Jun-09 8:06 
GeneralRe: Problem in thread (VB.Net 2005) Pin
priyamtheone22-Jun-09 5:58
priyamtheone22-Jun-09 5:58 
QuestionSMTP Mails - working in one computer not with other computer Pin
Paramu197317-Jun-09 4:58
Paramu197317-Jun-09 4:58 
AnswerRe: SMTP Mails - working in one computer not with other computer Pin
nlarson1117-Jun-09 6:21
nlarson1117-Jun-09 6:21 
GeneralRe: SMTP Mails - working in one computer not with other computer Pin
Paramu197317-Jun-09 19:16
Paramu197317-Jun-09 19:16 
GeneralRe: SMTP Mails - working in one computer not with other computer Pin
Rajesh Anuhya17-Jun-09 20:33
professionalRajesh Anuhya17-Jun-09 20:33 
QuestionUsing 'SetParent' function in VB 2008 Pin
Filippo197417-Jun-09 2:31
Filippo197417-Jun-09 2:31 
Hi all,
I'm new into the forum and I have a question for you. How can I use the Win API 'SetParent' under VB 2008 to open a secondary form into a picturebox on a primary form? I need this because I want simulate a MDI form. For VB6 I used the following code and It works fine:

'<<declaration>>
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

'<<function>>
Public Function SetParentInRect(FormChild As Variant, FormParent As Variant)

On Error GoTo ErrorHandler

Dim lChild As Long
Dim lParent As Long


On Error Resume Next

If IsObject(FormChild) Then
lChild = CallByName(FormChild, "hwnd", VbGet)
If lChild = 0 Then Err.Raise 1000, , "Cannot obtain handle from formchild"
Else
lChild = CLng(FormChild)
End If

If IsObject(FormParent) Then
lParent = CallByName(FormParent, "hwnd", VbGet)
If lParent = 0 Then Err.Raise 1000, , "Cannot obtain handle from formparent"
If TypeName(FormParent) = "MdiMain" Then
lParent = FindWindowEx(lParent, 0&, "MDIClient", vbNullString)
End If
If TypeName(FormParent) = "frmMain" Then
lParent = FormParent.picContainer.hWnd
End If
Else
lParent = CLng(FormParent)
End If

If Not IsWindow(lChild) Then Err.Raise 1000, , "Invalid form Handle : " & lChild
If Not IsWindow(lParent) Then Err.Raise 1000, , "Invalid form Handle : " & lParent

SetParent lChild, lParent

If False Then
ErrorHandler:
Err.Raise Err.Number, IIf(Len(Err.Source) > 0, Err.Source & "->", "") & "clsParent", Err.Description
End If
End Function

The sencondary form have the follwing property:
startupposition = manual
borderstyle = none
windowsstate = maximized

Is there anyone can help me (to translate this function in VB 2008)?
Thanks a lot,
Filippo
AnswerRe: Using 'SetParent' function in VB 2008 Pin
nlarson1117-Jun-09 3:33
nlarson1117-Jun-09 3:33 
GeneralRe: Using 'SetParent' function in VB 2008 Pin
Filippo197417-Jun-09 3:55
Filippo197417-Jun-09 3:55 
QuestionPropertyGrid image Selection while Property is ReadOnly Problem Pin
VB 8.017-Jun-09 2:04
VB 8.017-Jun-09 2:04 
QuestionIssue while creating tables in ms access using VB.NET ADOX [modified] Pin
sivakumar.mariappan17-Jun-09 0:32
sivakumar.mariappan17-Jun-09 0:32 
AnswerRe: Issue while creating tables in ms access using VB.NET ADOX Pin
Johan Hakkesteegt17-Jun-09 0:47
Johan Hakkesteegt17-Jun-09 0:47 
GeneralRe: Issue while creating tables in ms access using VB.NET ADOX Pin
sivakumar.mariappan17-Jun-09 1:15
sivakumar.mariappan17-Jun-09 1:15 
AnswerRe: Issue while creating tables in ms access using VB.NET ADOX Pin
Ashfield17-Jun-09 1:25
Ashfield17-Jun-09 1:25 
GeneralRe: Issue while creating tables in ms access using VB.NET ADOX Pin
sivakumar.mariappan17-Jun-09 3:49
sivakumar.mariappan17-Jun-09 3:49 
GeneralRe: Issue while creating tables in ms access using VB.NET ADOX Pin
Ashfield17-Jun-09 8:57
Ashfield17-Jun-09 8:57 
QuestionRead the Excel upto used range Pin
Member 402761716-Jun-09 21:36
Member 402761716-Jun-09 21:36 
AnswerRe: Read the Excel upto used range Pin
Johan Hakkesteegt16-Jun-09 21:54
Johan Hakkesteegt16-Jun-09 21:54 
AnswerRe: Read the Excel upto used range Pin
Ebube17-Jun-09 0:09
Ebube17-Jun-09 0:09 
QuestionHow to identify the Users Network Credentials? [modified] Pin
Paramu197316-Jun-09 21:20
Paramu197316-Jun-09 21:20 
AnswerRe: How to identify the Users Network Credentials? Pin
Johan Hakkesteegt16-Jun-09 21:49
Johan Hakkesteegt16-Jun-09 21:49 
QuestionChange the size od MDI container in the parent form Pin
sohaib_a16-Jun-09 21:06
sohaib_a16-Jun-09 21:06 
AnswerRe: Change the size od MDI container in the parent form Pin
Dave Kreskowiak17-Jun-09 7:57
mveDave Kreskowiak17-Jun-09 7:57 
GeneralRe: Change the size od MDI container in the parent form Pin
sohaib_a17-Jun-09 19:20
sohaib_a17-Jun-09 19:20 

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.