Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <exec/types.h>
- #include <libraries/dos.h>
- #include <libraries/dosextens.h>
- #include <intuition/intuition.h>
- #include <proto/exec.h>
- #include <stdio.h>
- #define APTR_TO_BPTR(x) ((ULONG)x >> 2)
- int main()
- {
- struct Process *process = (struct Process *)FindTask(NULL);
- struct MsgPort *con_mp = (struct MsgPort *)process->pr_ConsoleTask;
- struct MsgPort *reply_port = CreatePort(NULL, 0);
- struct InfoData *id = AllocMem(sizeof(struct InfoData), 0);
- struct StandardPacket sp;
- sp.sp_Msg.mn_Node.ln_Type = NT_MESSAGE;
- sp.sp_Msg.mn_Node.ln_Pri = 0;
- sp.sp_Msg.mn_Node.ln_Name = (char *)&sp.sp_Pkt;
- sp.sp_Msg.mn_Length = sizeof(struct StandardPacket);
- sp.sp_Msg.mn_ReplyPort = reply_port;
- sp.sp_Pkt.dp_Link = &sp.sp_Msg;
- sp.sp_Pkt.dp_Port = reply_port;
- sp.sp_Pkt.dp_Type = ACTION_DISK_INFO;
- sp.sp_Pkt.dp_Arg1 = APTR_TO_BPTR(id);
- sp.sp_Pkt.dp_Arg2 = 0;
- sp.sp_Pkt.dp_Arg3 = 0;
- PutMsg(con_mp, &sp.sp_Msg);
- Wait(1L << reply_port->mp_SigBit);
- GetMsg(reply_port);
- struct Window *win = (struct Window *)id->id_VolumeNode;
- printf("Window position: (%3d, %3d)\n", win->LeftEdge, win->TopEdge);
- printf("Window size: (%3d, %3d)\n", win->Width, win->Height);
- FreeMem(id, sizeof(struct InfoData));
- DeletePort(reply_port);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement