C++ Code Snippet to VB
C++ Code Snippet to VB
C++ Code Snippet to VB
C++ Code Snippet to VB
C++ Code Snippet to VB
C++ Code Snippet to VB C++ Code Snippet to VB C++ Code Snippet to VB C++ Code Snippet to VB C++ Code Snippet to VB C++ Code Snippet to VB C++ Code Snippet to VB C++ Code Snippet to VB
C++ Code Snippet to VB C++ Code Snippet to VB
C++ Code Snippet to VB
Go Back  Xtreme Visual Basic Talk > > > C++ Code Snippet to VB


Reply
 
Thread Tools Display Modes
  #1  
Old 04-24-2017, 10:42 AM
mms mms is offline
Ultimate Contributor
 
Join Date: Jul 2002
Location: Hamilton, Ontario
Posts: 1,859
Default C++ Code Snippet to VB


Following is a C++ code snippet that I am trying to convert to VB.
In the C++ Switch block I am trying to understand the dimming of lpMidiHdr

In Case 1 lpMidiHdr is dimmed "on-the-fly" as LPMIDIHDR
In Case 2 lpMidiHdr is pre-dimmed as LPMIDIHDR

Is there any special reason to do this, and this is doing something I might not be aware of?
C++ allows duplicate declarations?

Code:
	case MM_MOM_DONE:
		if (dwBuffCount == 0) {
			LPMIDIHDR lpMidiHdr = (LPMIDIHDR)lParam;

		    // more code

                }

		return 0;
	
	case MM_MOM_POSITIONCB: {
                LPMIDIHDR    lpMidiHdr;

                lpMidiHdr = (LPMIDIHDR)lParam;
			
                // more code

		return 0;
	}
I'm thinking the following would be VB equivalent?
Code:
Dim lpMidiHdr As LPMIDIHDR

Select Case uMsg
    Case MM_MOM_DONE
        If (dwBuffCount = 0) Then
            lpMidiHdr = lParam
        End If
    Case MM_MOM_POSITIONCB
        lpMidiHdr = lParam
End Select
Reply With Quote
  #2  
Old 04-25-2017, 07:53 AM
OnErr0r's Avatar
OnErr0rC++ Code Snippet to VB OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default

Looks good. And yours is a bit cleaner.
__________________
Quis custodiet ipsos custodues.
Reply With Quote
  #3  
Old 04-28-2017, 04:03 PM
mms mms is offline
Ultimate Contributor
 
Join Date: Jul 2002
Location: Hamilton, Ontario
Posts: 1,859
Default

A second set of eyes (and a confirmation) is always good.

Thank you.
Reply With Quote
Reply

Tags
lpmidihdr, code, c++, dwbuffcount, mm_mom_done, select, lparam, mm_mom_positioncb, return, lpmidihdrlparam;, snippet, convert, switch, understand, dimming, lpmidihdr;, block, thinking, umsg, dim, equivalent, pre-dimmed, special, reason, declarations


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
C++ Code Snippet to VB
C++ Code Snippet to VB
C++ Code Snippet to VB C++ Code Snippet to VB
C++ Code Snippet to VB
C++ Code Snippet to VB
C++ Code Snippet to VB C++ Code Snippet to VB C++ Code Snippet to VB C++ Code Snippet to VB C++ Code Snippet to VB C++ Code Snippet to VB C++ Code Snippet to VB
C++ Code Snippet to VB
C++ Code Snippet to VB
 
C++ Code Snippet to VB
C++ Code Snippet to VB
 
-->