|
Das deutsche QBasic- und FreeBASIC-Forum Für euch erreichbar unter qb-forum.de, fb-forum.de und freebasic-forum.de!
|
Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
Autor |
Nachricht |
csde_rats
Anmeldungsdatum: 07.01.2007 Beiträge: 2292 Wohnort: Zwischen Sessel und Tastatur
|
|
Nach oben |
|
|
Elektronix
Anmeldungsdatum: 29.06.2006 Beiträge: 742
|
Verfasst am: 29.05.2007, 09:16 Titel: |
|
|
In der Regel CreateWindowEx. Du mußt nur beim Parameter für den Fenstertyp das Richtige eingeben.
Hängt allerdings auch davon ab, ob Du die Fenster selbst erstellst oder aus einer Ressource lädst. |
|
Nach oben |
|
|
csde_rats
Anmeldungsdatum: 07.01.2007 Beiträge: 2292 Wohnort: Zwischen Sessel und Tastatur
|
Verfasst am: 29.05.2007, 12:33 Titel: |
|
|
ne, das meinte ich so nicht meinte eher sowas
Code: |
#include "windows.bi"
[...]
MessageBox NULL, ausgabe, "Deine CPU", null
|
Also so ähnlich wie in VB oder BB... _________________ If hilfreicher_Beitrag then klick(location.here)
Klick |
|
Nach oben |
|
|
Elektronix
Anmeldungsdatum: 29.06.2006 Beiträge: 742
|
Verfasst am: 29.05.2007, 13:33 Titel: |
|
|
Hier die MessageBox aus einem Tutorial. Funktioniert aber nur mit der MessageBox so, bei allen anderen Ressourcen brauchste doch CreateWindowEx.
Code: |
#include "windows.bi"
if MessageBox(0, "Kann man sich eigentlich mehr" + chr(13, 10) + "als zweimal"+_
" halb totlachen?", "Ich hätt' da mal ne Frage...", MB_ICONQUESTION or _
MB_YESNO) = IDYES then
MessageBox(0, "Natürlich kann man." + chr(13, 10) + "Sofern man sich zwis"+_
"chendrin erholt", "Ja", MB_ICONINFORMATION or MB_OK)
else
MessageBox(0, "Nicht? Finde ich aber schon.", "Nein", MB_ICONEXCLAMATION _
OR MB_OK)
end if
|
|
|
Nach oben |
|
|
csde_rats
Anmeldungsdatum: 07.01.2007 Beiträge: 2292 Wohnort: Zwischen Sessel und Tastatur
|
|
Nach oben |
|
|
Elektronix
Anmeldungsdatum: 29.06.2006 Beiträge: 742
|
Verfasst am: 29.05.2007, 14:55 Titel: |
|
|
für alle WinAPI-Funktionen brauchst Du nur die windows.bi. Alle anderen relevanten Dateien werden von der windows.bi selbsttätig eingebunden. |
|
Nach oben |
|
|
csde_rats
Anmeldungsdatum: 07.01.2007 Beiträge: 2292 Wohnort: Zwischen Sessel und Tastatur
|
Verfasst am: 29.05.2007, 15:10 Titel: |
|
|
Eigent. wolte ich die Paramter wissen (ohh großer API-Guide )
Aber.. kann mir mal jemand die Paramter erklären?
Code: |
Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
|
_________________ If hilfreicher_Beitrag then klick(location.here)
Klick |
|
Nach oben |
|
|
Elektronix
Anmeldungsdatum: 29.06.2006 Beiträge: 742
|
Verfasst am: 29.05.2007, 15:55 Titel: |
|
|
Wenn Du Dich intensiver mit der Windows-API beschäftigen willst, poste mal im entsprechenden Forum. Und such Dir ein paar gute Tutorials (die besten gibt es leider in C.)
Hier aus der Online-Hilfe von Borland C++:
Zitat: | HWND CreateWindowEx(
DWORD dwExStyle, // extended window style
LPCTSTR lpClassName, // pointer to registered class name
LPCTSTR lpWindowName, // pointer to window name
DWORD dwStyle, // window style
int x, // horizontal position of window
int y, // vertical position of window
int nWidth, // window width
int nHeight, // window height
HWND hWndParent, // handle to parent or owner window
HMENU hMenu, // handle to menu, or child-window identifier
HINSTANCE hInstance, // handle to application instance
LPVOID lpParam // pointer to window-creation data
);
Parameters
dwExStyle
Specifies the extended style of the window. This parameter can be one of the following values:
Style Meaning
WS_EX_ACCEPTFILES Specifies that a window created with this style accepts drag-drop files.
WS_EX_APPWINDOW Forces a top-level window onto the taskbar when the window is minimized.
WS_EX_CLIENTEDGE Specifies that a window has a border with a sunken edge.
WS_EX_CONTEXTHELP Includes a question mark in the title bar of the window. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message. The child window should pass the message to the parent window procedure, which should call the WinHelp function using the HELP_WM_HELP command. The Help application displays a pop-up window that typically contains help for the child window.WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles.
WS_EX_CONTROLPARENT Allows the user to navigate among the child windows of the window by using the TAB key.
WS_EX_DLGMODALFRAME Creates a window that has a double border; the window can, optionally, be created with a title bar by specifying the WS_CAPTION style in the dwStyle parameter.
WS_EX_LEFT Window has generic "left-aligned" properties. This is the default.
WS_EX_LEFTSCROLLBAR If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the vertical scroll bar (if present) is to the left of the client area. For other languages, the style is ignored and not treated as an error.
WS_EX_LTRREADING The window text is displayed using Left to Right reading-order properties. This is the default.
WS_EX_MDICHILD Creates an MDI child window.
WS_EX_NOPARENTNOTIFY Specifies that a child window created with this style does not send the WM_PARENTNOTIFY message to its parent window when it is created or destroyed.
WS_EX_OVERLAPPEDWINDOW Combines the WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE styles.
WS_EX_PALETTEWINDOW Combines the WS_EX_WINDOWEDGE, WS_EX_TOOLWINDOW, and WS_EX_TOPMOST styles.
WS_EX_RIGHT Window has generic "right-aligned" properties. This depends on the window class. This style has an effect only if the shell language is Hebrew, Arabic, or another language that supports reading order alignment; otherwise, the style is ignored and not treated as an error.
WS_EX_RIGHTSCROLLBAR Vertical scroll bar (if present) is to the right of the client area. This is the default.
WS_EX_RTLREADING If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the window text is displayed using Right to Left reading-order properties. For other languages, the style is ignored and not treated as an error.
WS_EX_STATICEDGE Creates a window with a three-dimensional border style intended to be used for items that do not accept user input.
WS_EX_TOOLWINDOW Creates a tool window; that is, a window intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the taskbar or in the dialog that appears when the user presses ALT+TAB.
WS_EX_TOPMOST Specifies that a window created with this style should be placed above all non-topmost windows and should stay above them, even when the window is deactivated. To add or remove this style, use the SetWindowPos function.
WS_EX_TRANSPARENT Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated.
WS_EX_WINDOWEDGE Specifies that a window has a border with a raised edge.
Using the WS_EX_RIGHT style for static or edit controls has the same effect as using the SS_RIGHT or ES_RIGHT style, respectively. Using this style with button controls has the same effect as using BS_RIGHT and BS_RIGHTBUTTON styles.
lpClassName
Points to a null-terminated string or is an integer atom. If lpClassName is an atom, it must be a global atom created by a previous call to GlobalAddAtom. The atom, a 16-bit value less than 0xC000, must be in the low-order word of lpClassName; the high-order word must be zero.
If lpClassName is a string, it specifies the window class name. The class name can be any name registered with the RegisterClass function or any of the predefined control-class names.
lpWindowName
Points to a null-terminated string that specifies the window name.
dwStyle
Specifies the style of the window being created. For a list of the window styles that can be specified in dwStyle, see CreateWindow.
x
Specifies the initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of the upper-left corner of the window relative to the upper-left corner of the parent window's client area.
If x is set to CW_USEDEFAULT, Windows selects the default position for the window's upper-left corner and ignores the y parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified for a pop-up or child window, the x and y parameters are set to zero.
y
Specifies the initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-coordinate of the window's upper-left corner, in screen coordinates. For a child window, y is the initial y-coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's client area. For a list box, y is the initial y-coordinate of the upper-left corner of the list box's client area relative to the upper-left corner of the parent window's client area.
If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is set to CW_USEDEFAULT, Windows ignores the y parameter.
nWidth
Specifies the width, in device units, of the window. For overlapped windows, nWidth is the window's width, in screen coordinates, or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT, Windows selects a default width and height for the window; the default width extends from the initial x-coordinates to the right edge of the screen; the default height extends from the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, the nWidth and nHeight parameter are set to zero.
nHeight
Specifies the height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen coordinates. If the nWidth parameter is set to CW_USEDEFAULT, Windows ignores nHeight.
hWndParent
Identifies the parent or owner window of the window being created. A valid window handle must be supplied when a child window or an owned window is created. A child window is confined to the client area of its parent window. An owned window is an overlapped window that is destroyed when its owner window is destroyed or hidden when its owner is minimized; it is always displayed on top of its owner window. Although this parameter must specify a valid handle if the dwStyle parameter includes the WS_CHILD style, it is optional if dwStyle
includes the WS_POPUP style.
hMenu
Identifies a menu, or specifies a child-window identifier, depending on the window style. For an overlapped or pop-up window, hMenu identifies the menu to be used with the window; it can be NULL if the class menu is to be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box control to notify its parent about events. The application determines the child-window identifier; it must be unique for all child windows with the same parent window.
hInstance
Identifies the instance of the module to be associated with the window.
lpParam
Points to a value passed to the window through the CREATESTRUCT structure referenced by the lParam parameter of the WM_CREATE message. If an application calls CreateWindow to create a multiple document interface client window, lpParam must point to a CLIENTCREATESTRUCT structure.
Return Values
If the function succeeds, the return value is the handle to the new window.
If the function fails, the return value is NULL.
Remarks
The CreateWindowEx function sends WM_NCCREATE, WM_NCCALCSIZE, and WM_CREATE messages to the window being created.
For information about the window control classes, window styles, and control styles used with this function, see the description of the CreateWindow function.
Windows 95: The system can support a maximum of 16,364 window handles. |
|
|
Nach oben |
|
|
Mao
Anmeldungsdatum: 25.09.2005 Beiträge: 4409 Wohnort: /dev/hda1
|
Verfasst am: 29.05.2007, 19:55 Titel: |
|
|
FoSu, ytwinky hat LutzIfers Tutorial mal als CHM hochgeladen. _________________ Eine handvoll Glück reicht nie für zwei.
--
|
|
Nach oben |
|
|
c.m.obrecht
Anmeldungsdatum: 09.03.2006 Beiträge: 377 Wohnort: Hofstetten SO, CH
|
Verfasst am: 29.05.2007, 21:45 Titel: |
|
|
Kann bestätigen, alles weitere als nur eine Messagebox oder ein mci einbinden oder so braucht intensive Auseinandersetzung mit der WinAPI (s. auch meine Frage im Windows spezifischen Forenteil, mit COde - zwar ASM aber der Umfang bleibt ähnlich).
Gibt es eigentlich auch etwas wie eine "Erleichterung" für FreeBasic, wie es für C++ MFC, wx, VCL usw. gibt (welches aber im Gegensatz zu meinen Versuchen mit Win32++ und wx unter C auch funktioniert)? _________________ ...längre blomstre gamle nord... |
|
Nach oben |
|
|
ytwinky
Anmeldungsdatum: 28.05.2005 Beiträge: 2624 Wohnort: Machteburch
|
Verfasst am: 29.05.2007, 22:28 Titel: |
|
|
Mao hat Folgendes geschrieben: | FoSu, ytwinky hat LutzIfers Tutorial mal als CHM hochgeladen. | *Stolzsei*
Ja, das habe ich wirklich gemacht..
..Zugriff darauf kriegt aber nicht jeder..
..z.Z. nicht einmal ich
Gruß
ytwinky _________________
v1ctor hat Folgendes geschrieben: | Yeah, i like INPUT$(n) as much as PRINT USING.. | ..also ungefähr so, wie ich GOTO.. |
|
Nach oben |
|
|
Elektronix
Anmeldungsdatum: 29.06.2006 Beiträge: 742
|
Verfasst am: 30.05.2007, 09:09 Titel: |
|
|
@Mao
ytwinky's Tutorial ist thematisch recht umfassend und hat lauffähige Programme (im Gegensatz zu den Tutorials auf der alten FreeBasic-Homepage ), enthält aber recht wenig Erklärungen (in manchen Kapiteln überhaupt keine)- braucht ja auch Zeit, sowas zu verfassen . Das hat mir geholfen, die mir bekannten C-Prozeduren in Basic zu übersetzen. Es reicht aber nicht, die API richtig zu verstehen.
@c.m.ombrecht
Solche Erleichterungen sind objektorientierte Kapselungen der API. Das ist in FreeBasic nicht möglich, weil FreeBasic keine volle Objektorientierung hat. Daß MFC oder wxWidgets bei Dir auch unter C funktioniert, liegt vermutlich daran, daß Du einen C++-Compiler verwendest. C++ ist 100%ig rückwärtskompatibel zu C. Ein MFC-Programm könntest Du mit einem reinen C-Kompiler nicht umsetzen.
Ich habe schon daran gedacht, ein paar Tutorials in Basic zu schreiben, aufbauend auf das von ytwinky- wenn er einverstanden ist . Aber das dauert natürlich seine Zeit.
Hier noch zwei Links zu API-Tutorials in C mit umfangreichen Erklärungen und Erläuterungen der jeweiligen Funktionsparameter:
http://www.win-api.de/tutorials.php?SessID=d420ca145d280cac60b4b94e47cd115b&SessID=d420ca145d280cac60b4b94e47cd115b
http://pronix.linuxdelta.de/C/win32/index.shtml |
|
Nach oben |
|
|
Mao
Anmeldungsdatum: 25.09.2005 Beiträge: 4409 Wohnort: /dev/hda1
|
Verfasst am: 30.05.2007, 14:02 Titel: |
|
|
Für meine Dinge hat's gereicht. _________________ Eine handvoll Glück reicht nie für zwei.
--
|
|
Nach oben |
|
|
csde_rats
Anmeldungsdatum: 07.01.2007 Beiträge: 2292 Wohnort: Zwischen Sessel und Tastatur
|
Verfasst am: 30.05.2007, 14:19 Titel: |
|
|
@Topic: mit der WinAPI finde ich das dann doch ein wenig kompliziert für meine Verhältnisse (und englisch-kenntnisse ... apiguide... ) ich habe da mal was von CGUI oder so gehört... weiß jemand was das ist? _________________ If hilfreicher_Beitrag then klick(location.here)
Klick |
|
Nach oben |
|
|
Elektronix
Anmeldungsdatum: 29.06.2006 Beiträge: 742
|
|
Nach oben |
|
|
csde_rats
Anmeldungsdatum: 07.01.2007 Beiträge: 2292 Wohnort: Zwischen Sessel und Tastatur
|
|
Nach oben |
|
|
ytwinky
Anmeldungsdatum: 28.05.2005 Beiträge: 2624 Wohnort: Machteburch
|
Verfasst am: 30.05.2007, 17:08 Titel: |
|
|
Hi,
Elektronix hat Folgendes geschrieben: | ytwinky's Tutorial ist thematisch recht umfassend und hat lauffähige Programme (im Gegensatz zu den Tutorials auf der alten FreeBasic-Homepage ).. | ..wie der Dateiname bereits vermuten läßt, ist es nicht mein Tutorial, ich habe es lediglich in eine Chm-Datei gepackt und
die läßt sich nun auch wieder runterladen..
*ytwinky.freebasic.deistwiederda*
Gruß
ytwinky _________________
v1ctor hat Folgendes geschrieben: | Yeah, i like INPUT$(n) as much as PRINT USING.. | ..also ungefähr so, wie ich GOTO.. |
|
Nach oben |
|
|
c.m.obrecht
Anmeldungsdatum: 09.03.2006 Beiträge: 377 Wohnort: Hofstetten SO, CH
|
Verfasst am: 30.05.2007, 17:22 Titel: |
|
|
@Elektronix:
MFC geht bei VC++ 2005 Express leider nicht und wx habe ich auch nicht zum Laufen gebracht (mit dem Borland Compiler); sollte eigentlich gehen aber der vom Form-Designer hergestellte Code löste über 100 Fehlermeldungen aus
Ach so ist FreeBasic zu wenig objektorientiert...nicht gewusst! _________________ ...längre blomstre gamle nord... |
|
Nach oben |
|
|
Elektronix
Anmeldungsdatum: 29.06.2006 Beiträge: 742
|
Verfasst am: 31.05.2007, 11:32 Titel: |
|
|
c.m.obrecht hat Folgendes geschrieben: | @Elektronix:
MFC geht bei VC++ 2005 Express leider nicht | Das überrascht mich- ist nämlich beides von Winzigweich. Vielleicht hast Du nur nicht den richtigen Header eingebunden. Nicht windows.h sondern stdafx.h oder afxres.h (glaub ich war es doch).
Zitat: |
und wx habe ich auch nicht zum Laufen gebracht (mit dem Borland Compiler); sollte eigentlich gehen aber der vom Form-Designer hergestellte Code löste über 100 Fehlermeldungen aus |
Über solche Fragen kannste mal hier Posten:
http://www.c-plusplus.de/forum/
Da gibts auch Unterforen zu MFC, wxWidgets, Borland-C-Builder u. a.. |
|
Nach oben |
|
|
c.m.obrecht
Anmeldungsdatum: 09.03.2006 Beiträge: 377 Wohnort: Hofstetten SO, CH
|
Verfasst am: 31.05.2007, 13:26 Titel: |
|
|
Klar, VC++ Express Edition kompiliert aber nur Konsolenprogramme sowie .NET (wie C# und VB halt). Für native Windows-Anwendungen braucht es ein SDK, das schaffte ich aber auch nicht (wieso ist die Einrichtung solcher DInge so nervend und komplizierter als eine nee Windows-Installation? ) Windows.h wird nicht erkannt.
Bei der Express Edition ist MFC auch nicht dabei.
Die Express an sich bringt eigentlich kaum etwas, die muss man schon massiv "umbauen"...
Danke, ja in diesem Forum bin ich ziemlich aktiv. _________________ ...längre blomstre gamle nord... |
|
Nach oben |
|
|
|
|
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen.
|
|