Calling function pointers

Hello all,

I was looking at the Dynamic Array functions exported by commctl32.dll
(prefixed DPA_ and DSA_)

http://msdn.microsoft.com/en-us/library/ff485930%28VS.85%29.aspx

Although there doesn't seem to be anything there that really couldn't
be achieved in VB, I was still slightly disappointed that some of the
more interesting functions (DPA_Merge for example) are exported by
ordinal only.

I'm assuming that this means those ones aren't callable from straight
VB.

Robert
0
Robert
9/3/2010 5:04:23 PM
vb.general.discussion 1016 articles. 0 followers. Follow

9 Replies
1372 Views

Similar Articles

[PageSpeed] 57

As far as I know, we can call API using ordinal number.

Example:
Private Declare Function IsUserAnAdmin Lib "shell32" () As Long

would be

Private Declare Function IsUserAnAdmin Lib "shell32" Alias "#680" () As Long

Source: vbnet.mvps.org


"Robert" <noname@noserver.com> wrote in message 
news:rq7286hjfoc5iobslpgt5u10f8sghmigu4@4ax.com...
| Hello all,


0
Abhishek
9/3/2010 5:24:33 PM
Robert presented the following explanation :
> exported by ordinal only.
>
> I'm assuming that this means those ones aren't callable from straight
> VB.

That's, in no way, a disqualifier on their use!  Examples:

   Private Declare Function SetWindowSubclass Lib "comctl32" Alias 
"#410" (ByVal hWnd As Long, ByVal pfnSubclass As Long, ByVal 
uIdSubclass As Long, ByVal dwRefData As Long) As Long

   Private Declare Function GetWindowSubclass Lib "comctl32" Alias 
"#411" (ByVal hWnd As Long, ByVal pfnSubclass As Long, ByVal 
uIdSubclass As Long, pdwRefData As Long) As Long

   Private Declare Function RemoveWindowSubclass Lib "comctl32" Alias 
"#412" (ByVal hWnd As Long, ByVal pfnSubclass As Long, ByVal 
uIdSubclass As Long) As Long

   Private Declare Function DefSubclassProc Lib "comctl32" Alias "#413" 
(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal 
lParam As Long) As Long

While those functions are exported by name from XP onward, you can use 
them with total success in any system that has v4.71+ of comctl32 
(Win98 and/or IE 4.01) if you declare they by ordinal as above.

-- 
..NET: It's About Trust!
http://vfred.mvps.org


0
Karl
9/3/2010 7:05:24 PM
Robert wrote:
....

Nomenclature nit...

DLL entry points identified by ordinal number are not "function pointers"...

--
0
dpb
9/3/2010 7:22:34 PM
On Fri, 3 Sep 2010 22:54:33 +0530, "Abhishek" <user@server.com> wrote:

>As far as I know, we can call API using ordinal number.
>

I really wasn't expecting that answer.

Thanks.

Now to decide if they are worth using for the custom control I'm
writing, rather than the dynamic array class I wrote myself.

0
Robert
9/3/2010 8:28:42 PM
On Fri, 03 Sep 2010 12:05:24 -0700, Karl E. Peterson <karl@exmvps.org>
wrote:

>While those functions are exported by name from XP onward, you can use 
>them with total success in any system that has v4.71+ of comctl32 
>(Win98 and/or IE 4.01) if you declare they by ordinal as above.

Thanks, Karl.

0
Robert
9/3/2010 8:28:55 PM
On Fri, 03 Sep 2010 14:22:34 -0500, dpb <none@non.net> wrote:

>Robert wrote:
>...
>
>Nomenclature nit...
>
>DLL entry points identified by ordinal number are not "function pointers"...

Yes, sorry about that.

I was thrown by the MSDN documentation for these functions which
states:

..... "is not exported by name or declared in a public header file. To
use it, you must use GetProcAddress and request ordinal 11 from
ComCtl32.dll to obtain a function pointer."

0
Robert
9/3/2010 8:29:25 PM
Robert wrote:
> On Fri, 03 Sep 2010 14:22:34 -0500, dpb <none@non.net> wrote:
> 
>> Robert wrote:
>> ...
>>
>> Nomenclature nit...
>>
>> DLL entry points identified by ordinal number are not "function pointers"...
> 
> Yes, sorry about that.
> 
> I was thrown by the MSDN documentation for these functions which
> states:
> 
> .... "is not exported by name or declared in a public header file. To
> use it, you must use GetProcAddress and request ordinal 11 from
> ComCtl32.dll to obtain a function pointer."
....

Yes, GetProcAddress returns the ordinal entry number as a C-style 
function pointer.  Remember MSDN API documentation is written for C.

--
0
dpb
9/3/2010 9:10:46 PM
On Fri, 03 Sep 2010 21:29:25 +0100, Robert <noname@noserver.com>
wrote:

>On Fri, 03 Sep 2010 14:22:34 -0500, dpb <none@non.net> wrote:
>
>>Robert wrote:
>>...
>>
>>Nomenclature nit...
>>
>>DLL entry points identified by ordinal number are not "function pointers"...
>
>Yes, sorry about that.
>
>I was thrown by the MSDN documentation for these functions which
>states:
>
>.... "is not exported by name or declared in a public header file. To
>use it, you must use GetProcAddress and request ordinal 11 from
>ComCtl32.dll to obtain a function pointer."

Yeah, you will see the term "pointer" a lot when people actually mean
a "Address", especially when describing System services, etc. since
most 'system' programmers are C programmers.

To be really picky - the term "pointer" shouldn't be used any time
outside the scope of a language that actually supports a 'pointer data
type' (especially never in VB or Java) - they should always use the
more correct term "address". 

But such a admonishment will only start a fight. <bg>

-ralph
0
ralph
9/3/2010 9:44:46 PM
Why spend the time in reinventing the wheel, when API based coomon controls 
are available?

Download the following VB source library which implement all the common 
controls as classes, with many properties and methods. No need to 
redistrubute any OCX. The only catch is that
anything created with CreateWindowEx doesn't fire Validate event in other 
controls, nor navigation keys such as tab will work, because VB doesn't know 
the API created window is there. The solution to this involves turning the 
class into UserControl, and implementing IOLEInPlaceActiveObject hack, so VB 
can "see" the control. Search the web for "vb IOLEInPlaceActiveObject" for 
more details.

http://sourceforge.net/projects/codebox/


0
Nobody
9/3/2010 10:12:10 PM
Reply:

Similar Artilces:

Populate Phone Call Fields When Created By Workflow
How does everyone else auto-populate the fields of a phone call when the phone call is auto-created by a workflow rule? My rule creates an "intro call" phone call activity everytime a new lead is created. I find it silly that the fields including phone number aren't pre-populated from the Lead. ...

The data area passed to a system call is too small
Hello, I have just tried to use some working VC++6.0 code compiled with the ..NET2003 complier and now get the error "The data area passed to a system call is too small" - error code 122. Can anyone help? Thanks, Clive "Clive Taylor" <CliveTaylor@discussions.microsoft.com> wrote in message news:D6C135E1-1D56-4385-A133-705B83041E38@microsoft.com... > Hello, > > I have just tried to use some working VC++6.0 code compiled with the > .NET2003 complier and now get the error "The data area passed to a system > call is too small" - error cod...

Field Service Call Management Template
I am suggesting that we have the ability to use templates when entering a service call in Service Call Entry/Update. We could have many of the items filled in according to the template making it quick to enter a service call and minimizing input errors. Thanks John Miele ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader a...

Equivalent of Excel AND() function?
Is there an equivalent of Excel's AND() function in Access? I have looked for threads related to "multiple conditions" but they all seem to be about multiple conditions yielding the same result. I would like have my formula yield a certain result only when two or more conditions are true. Right now my formula is: NewVendor:IIf([Category]="Leave","SL0001-1") But I only want to assign the NewVendor SL0001-1 if the record also meets the condition [AGoal]=True. Can I do this? I have looked in help and here in the newsgroups and I'm not seeing it. ...

how do i get the collate function to work?
I have not been able to get the collate function to work with this printer; either in Publisher or Word. I'm using a HP color inkjet printer cp1700. Any ideas? Thanks On Sun, 19 Feb 2006 04:03:07 +0000, Dogcatlady wrote (in article <38AA3CB6-8B28-4D30-BE11-AF08337048A9@microsoft.com>): > I have not been able to get the collate function to work with this printer; > either in Publisher or Word. I'm using a HP color inkjet printer cp1700. > Any ideas? > > Thanks > With all due respect, as you cannot get it to work in either Publisher or Word then th...

Using functions and subroutines in other modules
I have some functions and subroutines define in Module1. How would I go about using/calling these functions from Module 2??? (sorry if that is a newb question) Use the CALL function like this: Code: -------------------- Sub One() Msgbox "This is One, Next is Two",vbokonly,"Sub One" Call Two End Sub Sub Two() Msgbox "This is Two, Next is Three",vbokonly,"Sub Two" Call Three End Sub Sub Three() Msgbox "This is Three, Next is Four",vbokonly,"Sub Three" Call Four End Sub ...

calling dll function.....error cannot convert parameter 2 from 'class CString *' to 'short *'
//This is dll function which i am calling to insert data short setQuoteToDB(BSTR* strDateTimeStamp, short* intMarketNo, BSTR* strMarketName, BSTR* strBid, BSTR* strAsk, short* intMarketState); // This is function from which i am getting data fom remote server void CArielProjectVer2Dlg::OnPriceChangeArielapictrl1(LPCTSTR SessionId, LPCTSTR RequestId, short MarketNo, LPCTSTR Market, LPCTSTR Bid, short BidDirection, LPCTSTR Ask, short AskDirection, LPCTSTR High, LPCTSTR Low, short MarketState, LPCTSTR Timestamp) // marketno and marketstate are define agin in program as CString for format ...

My app calling API NetMessageBufferSend doesn't work recently!
Hi, I have an API call problem in VC6 to ask you for help. I wrote a LAN application to send pop up message between PCs in LAN as command "net send" does. I called Platform SDK API NetMessageBufferSend in my VC program: ....... success = NetMessageBufferSend( NULL, //pszServerName, wszMsgTo, wszMsgFrom, (LPBYTE)wszMsg, dwLen*2); ....... The wszMsgTo parameter is an unicode string for string such as "192.168.0.x". In fact, it worked fine some days ago while it fails to send message now. The return value "success" is 2273 NERR_NameNotFound. To my s...

index/if function
A B C D E F G H I Acct# Inv# Date Amt Sales Total Alloc Alloc Alloc Tax Amt Amt S.Tax Total 68847 121508 1/15/09 $2,358 $2,358 $0 $0 $0 68847 011509 2/17/09 $1,470 $30 $1,500 $0 $0 $0 75181 110509 12/7/09 $890 $10 $900 $0 $0 $0 9201(II) 1209/75 5/12/09 $1,200 $0 $1,200 $672 $0 $672 9201(III) 1209/75 5/12/09 $528 $0 $528 $0 $0 $0 Invoice data is on...

Error in sum function when using merged cells
Help! I recently discovered an error in my shipping worksheet. sometimes need to merge certain cells when I am combining items fro different purchase orders into the same shipment. However, when totaled the column (SUM) containing the merged cells, it delivers wrong answer. Specifically column F and column H that contain the merged cells don' add up correctly. Column F is +1 more than it should be. Column H i +125 more than it should be. I have been using this feature for about 6 months, and this is th first time it did this. Any ideas why the error +----------------------...

Opening a a a file handle as a file pointer
Hi all I have a file handle. I want to open it as a FILE stream so that I can use higher level operators like cin/cout and fprintf/fscanf. Can someone suggest me a solution? Obviously the process startup code converts the file descriptor is receives from parent for stdin,stdout and stderr. So there should be a function to do it. regards, Sudhakar "sudhakarg79" <sudhakarg79@discussions.microsoft.com> wrote in message news:ECF7527B-A036-48EF-B2FB-CA8985330D3E@microsoft.com... > > Hi all > > I have a file handle. I want to open it as a FILE stream so...

using excel functions in a macro
I have written my own function FindNominal (as below) in a macro in excel. I want to use this function repeatedly in my excel spreadsheet. Function FindNominal(NomCode) FindNominal = Vlookup(NomCode, IMPORTDOC, 5 false) End Function but it does NOT work. It reports Vlookup is not recognised. Do i need to write an import statement? IMPORTDOC is defined as a range of cells in excel by the name, define command. I take it this is acceptable? Thanks pls post in ONE group only -- Don Guillett SalesAid Software dguillett1@austin.rr.com "James Cornthwaite" <jamescornthwait...

Creating a template for a cross-functional flowchart
Hi, I use Visio 2003. I am trying to create a template for a cross-functional flowchart. 1) The title bar needs to be 0.5in in height, containing the logo, revision number, approver name, etc. 2) This is followed by a blank frame of height 0.25in. 3) Then come 5 bands. The user should be able to add or delete bands as required. I created a cross-functional flowchart with 5 bands (There is a title bar, a blank frame, and 5 bands). I then used the shapesheet to increase the height of the title bar. Then I added the logo and other details to the title bar and saved this as a template. Af...

Need help with if function
Sorry if this is a double post. I don't see my first one. Need help with the if function. If cell K84 says Peds, I need N84 to say Peds. If cell K84 says Psy, I need N84 to say Psy. If K84 has any other description, I need N84 to say Other. How do I write this? Thanks for your help. -- Donna Try this: =IF(K84="","",IF(OR(K84={"peds","psy"}),K84,"Other")) -- HTH, RD --------------------------------------------------------------------------- Please keep all correspondence within the NewsGroup, so all may ben...

A Lookup function does not work
Hi, This is my first posting. I am using Exel 2000. I have 2 separate spreadsheets that have some similar columns but not all of the data in the similar columns is the same. What I want to do is take column A in spreadsheet#1 and find this same value in Column B in Spreadsheet#2 and then insert into column 3 in spreadsheet #1 a value from a different column in spreasheet #2 that corresponds to the row in which the value was looked up in Column B in spreadsheet#2. What I am doing is comparing 2 different inventory files that have stock codes in columns and quantities in another column, but n...

Using excel if function on a pricing spreadsheet
I am trying to simplify a pricing spreadsheet that I use at work. I a using the following criteria; the $ value of a product, the descriptio of a product that I have on a cost page. What I want to do is when type in the description of product X in a specific cell, I want the value of that product returned to another specific cell. Example: Lexan14SS (in a cell); 1.75 ($ value in another cell). On a pricing spreadsheet I type in Lexan14SS and I want that specific value returned to another cell. Of course though i will have mutipl product descriptions and prices to go along with those produc...

SaveBarState() fails when it is called from a thread
Hi, In my application, I use SaveBarState() for persisting control bar state. The code fragment is something like this. void CMainFrame::OnSavePersistance() { SaveBarState(_T("My Persistence")); // Saves some information to an xml file } Since my xml saving takes some time I changed the code to execute in a thread UINT ThreadFn(LPVOID pParam) { CMainFrame* pThis = (CMainFrame*)pParam; pThis->SaveBarState(_T("My Persistence")); return 0; } void CMainFrame::OnCntrlbartst() { AfxBeginThread( ThreadFn, this ); } But, now in the thread function SaveBarState...

Which function for smoothing average?
Say I have the following data in a column: 2 4 1 5 6 25 The data entry of 25 will skew an average. Which Excel function can I use to offset such a skew? Thanks, Brett There are myriad methods for excluding data from data sets - some even valid, but no one Excel function. If these are sample data, why do you assume that 25 skews the average? 25 falls within 2 standard deviations of the sample mean, so it's hard to justify excluding it from a normally distributed population. If they're not, what criterion would you apply to determine that a particular value skews the average. ...

Prohibiting Scalar Function Creation
I am running into a situation where the developers are writing many scalar functions to do "lookups". Then in their queries, they invoke the scalar in the SELECT clause with an argument to avoid explict joins in their statements. This approach is going to cause lots of problems with performance, and it also makes the SQL very difficult to debug. It is really an anti- SQL approach. Is there a way with SQL 2008 policies to simply prohibit the creation of scalar functions? What about with DDL trigger? I think we need to have some very serious talks about standards, ...

dtor not called
VS2008 SP1. WinXP x64 SP2. Compiled as 32-bit. I'm using the feature pack to update my GUI. When I close the app, my CMDIFrameWndEx derived class's destructor is not being called leaving a zombie process still running. What could be the explanation? Thanks, Drew On Feb 16, 1:59=A0pm, "Drew" <d...@dam.com> wrote: > VS2008 SP1. WinXP x64 SP2. Compiled as 32-bit. > I'm using the feature pack to update my GUI. When I close the app, my > CMDIFrameWndEx derived class's destructor is not being called leaving a > zombie process still runn...

Calling an ISAPI server using directories
Hello, I'm trying to write an ISAPI server, but instead of calling different functions using their names (E.g.:): http://localhost/scripts/isapi.dll (Default function) http://localhost/scripts/isapi.dll?test (Test function) I would like to use directories, as following: http://localhost/scripts/isapi.dll/page1 http://localhost/scripts/isapi.dll/page2 I believe that, if I write my webpages like this, MFC will always call the function default as if it has been called from the directory page1 or page2 (am I right?) I'm looking for a way to identify this "directory&qu...

Hand mouse pointer
This is a multi-part message in MIME format. ------=_NextPart_000_0013_01C792F0.88B26EF0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable My app display a world map. I already detect all mouse movements over this map.. I would change the mouse pointer to a Hand when passing over lands, and back to normal over seas.. I know how to calculate this, and already have mouse positions, etc.. My problem is simply to turn ON and OFF the mouse pointer into a Hand, and back to normal. It seams I can't reach the windows.forms namespace to get...

IF and Right Functions
Hello, I have part #'s that end in 3 or 4 characters, some with a space. I would like to display the last 3 or 4 characters in another column. I tried using the IF and Right functions and have not solved it. I thank you in advanced for your help on this formula. Example: Part # New Column (Result) 30-179-TC1 TC1 30-181-T C2 T C2 30-185-TC23 TC23 Hi, Try this for a string in a1 and drag down =MID(A1,FIND("^^",SUBSTITUTE(A1,"-","^^",LEN(""&A1)-LEN(SUBSTITUTE(A1,"-",""...

no show all function in dropdown list in Pivot Table
Dear Sir, I'm using excel 2000 professional version. When I create new pivot table, everthing is fine but once I want to look at the specific item, I have no "show all" function in the dropdown list of item field. So that I have to unmark all items, instead of only unmark the "show all". How can I have "show all" function in this case? thanks In Excel 2000, and earlier versions, the Show All checkbox isn't available. You can use programming to hide or show the items -- there's sample code here: http://www.contextures.com/xlPivot03.html...

Exiting/Calling procedure
I have the following procedure that calls Balance1(UserForm).... Sub BalanceFirst() Balance1.Show Call First End Sub If the cancel button is selected on the Balance1.... Private Sub CancelButton_Click() Unload Me End Sub .....then, I would like it to stop the whole procedure at this point and not carry on with the next line in the procedure that called it, namely the line Call First. .....But, if the OK button is selected, I would like it to do Call First and then jump back and do the rest of the code in the OKButton_Click procedure. Can this be accomplished? Rob "rob nobel" &l...