|
PowerBASIC Forums
![]() PowerBASIC for Windows
![]() CONTROL SEND versus SendDlgItemMessage (Page 1)
|
This topic is 2 pages long: 1 2 |
next newest topic | next oldest topic |
| Author | Topic: CONTROL SEND versus SendDlgItemMessage |
|
Egbert Zijlema Member |
Hi Folks, As far as I can see, all the DDT CONTROL statements are really STATEMENTS, no FUNCTIONS. CONTROL SEND hDlg, idCtrl, %LB_GETCOUNT, 0, 0 Am I right? elements = SendDlgItemMessage hDlg, idCtrl, %LB_GETCOUNT, 0, 0does the trick, of course, but similar DDT functions would be very nice. Something for the wishlist? ------------------ [This message has been edited by Egbert Zijlema (edited July 25, 2001).] IP: Logged |
|
Lance Edmonds Member |
Done! ![]() CONTROL SEND can receive a value, just as the API function can return...
IP: Logged |
|
Semen Matusovski Member |
Full form (see PB.Hlp) is CONTROL SEND hDlg&, Id&, Msg&, wParam&, lParam& TO result& ------------------ IP: Logged |
|
Egbert Zijlema Member |
Thank you, Lance and Semen. ------------------ IP: Logged |
|
Bruce Wood Member |
Lance or other knowledgeable parties. Do I understand the meaning of these post? 1). Can I use all of the PB Control and Dialog statements to send and manipulate existing Windows that I did not make? 2). For an existing Window w/Children, Do I need to Enum.. to get the Windows handle? 3). What API or command do I use then to get the idCtrl after I have the Windows handle? (I fixed this Question) 4). If my final results are to send a Text message to a ComboBox or Edit box. I must admit. I find it very frustrating that there is no book that I can buy which gives me an example/tutorial on the proper use of the Windows API's. Under PowerBasic of course. Mr. Appelman's Book VB guide to Win32 API, is frankly very lacking, just definitions on the API's, but very very few examples on how the API is used. Thx for looking. Bruce
[This message has been edited by Bruce Wood (edited December 13, 2002).] IP: Logged |
|
Tom Hanlin Member |
It is generally not good to mix PowerBASIC DDT commands with Windows calls. Sometimes it's ok but, you need to know a lot about what you're doing before trying this. I'll leave details to others, as this is not an area I know very well. ------------------ IP: Logged |
|
Pierre Bellisle Member |
Bruce, many things can be done, some look pretty hard (at least to me). Hope you will have some fun with following code... It's not DDT but... Start your PowerBASIC COM Browser and try this...
------------------ Pierre Bellisle [This message has been edited by Pierre Bellisle (edited February 27, 2004).] IP: Logged |
|
Gösta H. Lovgren-2 Member |
quote: Hi Pierre, I tried your code fragment and it compiled fine. Now can you tell me what it What I think it does is look for a dialog with "PowerBASIC COM Browser" in it (hProc = FindWindow("", "PowerBASIC COM Browser")) and return thehandle of that dialog. Is that right? Then: hControl = GetDlgItem(hProc, 1027)return the Id of the control that "PowerBASIC COM Browser" appears in. Is that right? And then: SendMessage hControl, %WM_SETTEXT, 0,VarPtr(SomeText) replace "PowerBASIC COM Browser" with SomeText ("This can be done!"). Is that Okay, if that's true (and it's always a BIG IF with me, or as me Ma used to say Oh, and one more thing: hControl = GetDlgItem(hProc, 1027) 'ID 1027 was found using Is 1027 a special number of some sort that causes a particular code handle to Also, [code] 'Some usefull api functions... 'FindWindowEx, GetDlgCtrlID, I'm certain they are "useful" but what do they do? They are not self explanatory [This message has been edited by Gösta H. Lovgren-2 (edited December 14, 2002).] IP: Logged |
|
Lance Edmonds Member |
quote: Your analysis is pretty much spot on. ![]()
quote:hControl = GetDlgItem(hProc, 1027) 'ID 1027 was found using 1027 is the ID number of a control on the target dialog. Essentially, the programmer assigns an ID number to a control when it is being created, and Windows generates a unique window handle to identify the control itself. The GetDlgItem() ASPI function is useful to find out the windows-assigned handle to a control whose ID number is known. You can use the complementary GetDlgCtrlID() function to determine the (programmer-assigned) ID from a control whose window handle is known. Therefore, if you know the handle of the window, you can find the ID if you only know the control handle; and you can find out the window handle if you only know the ID.
However, without an understanding of the principles of message-based programming, then you might still struggle with the explanations. Therefore I HIGHLY recommend that you invest in yourself and get a good Windows programming theory book, such as Petzold's "Programming Windows". See http://www.powerbasic.com/support/forums/Forum2/HTML/000031.html for a list of recommended titles. Books on Windows programming are rarely a bad investment if you are serious about learning Windows programming (especially if you want to learn about GUI programming). If you understand how Windows works, you'll find it much easier to write "proper" windows applications. I hope this helps! ------------------ IP: Logged |
|
Gösta H. Lovgren-2 Member |
quote: Your analysis is pretty much spot on. Thank you. Now I am
quote:hControl = GetDlgItem(hProc, 1027)Is 1027 a special number of
quote: Sorry, but that didn't answer my question. I'm well aware of what a ControlId
quote: I'm not sure I understand. Wouldn't the programmer ALREADY know the ControlID?
quote: I would understand it clearly if the last sentence read: "and you can find out
quote:First step would be to read about them in Win32.HLP... http://www .powerbasic.com/files/pub/mstools/win32.zip (8Mb) However, without an understanding of the principles of message-based Therefore I HIGHLY recommend that you invest in yourself and get a good Windows Books on Windows programming are rarely a bad investment if you are serious I hope this helps! [/B][/QUOTE] I have to tell you this last section is of NO help at all. I don't want to sound It demonstrates to me you (and many others here) don't really comprehend the What WOULD be REALLY helpful is to have a separate forum where Newbies could go Then we could go and experiment and incorporate on our own, and just maybe, for Lance, I honestly believe you cannot understand how intimidating posting on this I don't think I am the only one who is in love with PB but is having trouble. ------------------ [This message has been edited by Gösta H. Lovgren-2 (edited December 14, 2002).] IP: Logged |
|
Bruce Wood Member |
Pierre: Many thanks, I compiled your code and it put's the words "This can be done!" in the Interface Prefix Box. Your code was very nicely done, to show what can be done. This is part that kills you. 'ID 1027 was found using EnumChildWindows, many example on PB BBS EnumChildWindows is not a trivial piece of code. I noticed you left that part out. Because it is just that, not trivial. Getting that Id is critical to sending the message. What constitutes a handle and what constitutes an ID? How does a programmer get the Handle and/or ID? It just seems that programming for Windows starts by being complicated from the very beginning. Simple Idea: Place some text into an Edit or ComboBox on the current screen. (Lucky for me, I know they are called that) Let's see.... what book would have this information? Well a book by Microsoft of course - "The complete guide to Win32 API Programming"....NOT Now let's look up "Sending Messages" or "Placing text on the screen" If you find something...Dollars to Donuts says it will be either esoteric mumbo jumbo - or nothing like what you really want. Probably no example or a very nasty looking C+ code structure. And it will be just a fragment of what you need to do the job. After struggling and maybe finding what you think is the proper API. You find out that this API requires input information that must be extracted from 5 other API calls and that you don't know what they are. Oh, and sending a message to a ListBox,Combo and or Edit use difference code. Yes, I am a programmer, 30 yrs , assembler, (I won't even go into trying to programming Windows in Assembler), Getting the proper information to program Windows should not be so difficult. Needing 4 or 5 books to maybe find the information you want. That is unreal. Ok, I'm a little older than most here maybe, but I want to still want to learn how to do this. It is so much quicker and easier to be given a working example or shone how to do something. PowerBasic: It would be a god send, to have a section that contains example coding, showing how it perform a large number of the most common or complex Window API calls. This forum has some of the best PB programmers around and maybe some of the best programmer period. They graciously contribute code and their time here, perhaps they would place some of there common code functions into this section. We "progressing" programmer would learn quicker and would not have to re-invent the wheel. Where is the complete "Guide to PowerBasic and Win32 API interfacing /with rip roaring examples" I'd buy that BOOK yesterday! Gösta H. Lovgren-2, I couldn't agree with you more.
------------------ IP: Logged |
|
Gösta H. Lovgren-2 Member |
quote: It is nice code. I just tried the code again (using the PB
quote: I wouldn't wanna bet on who is older, but I've been retired
quote:
quote: If the truth were know, I'll plenty others who would agree too. ------------------ IP: Logged |
|
JOSE ROCA Member |
Have you started the PowerBASIC COM Browser? If you don't start it nothing can happen... ------------------ IP: Logged |
|
Pierre Bellisle Member |
OK, I was lazy, let's try another one, more complete... Still have to run "PowerBASIC COM Browser" program first. (In PB ide, Tool, PowerBASIC COM Browser) This one have the famous EnumWindows and EnumChildWindows function wrapped in it. I've tryed to add comments to the best of my knowledge. I don't know for other, but for me it was a very long and hard study before I can come up with this kind of code... Thanks to PB gurus, for me, no-can-do without them... Windows is a very complex beast, understanding it is a never ending thrill... Hope this help. Ciao. Some comment added and code updtate 2002/12/15 Code moved to source code at http://www.powerbasic.com/support/forums/Forum7/HTML/001681.html Topic: EnumWindows and EnumChildWindows [This message has been edited by Pierre Bellisle (edited December 15, 2002).] IP: Logged |
|
Bruce Wood Member |
Pierre: Wow, now that's more like it. I will enjoy consuming this code. Thank you very much!
Bruce ------------------ IP: Logged |
This topic is 2 pages long: 1 2 All times are EasternTime (US) | next newest topic | next oldest topic |
![]() |
|
Copyright © 1999-2007 PowerBASIC, Inc. All Rights Reserved.