لطفا همیشه زبان برنامه نویسی رو در عنوان سوال مشخص کنید.سلام خدمت تمام دوستان.
با کدوم تابع api میتونم سایز screen resolution رو بگیرم؟؟؟اگه میشه با نمومه.
Private Const SM_CXSCREEN As Long = 0
Private Const SM_CYSCREEN As Long = 1
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Sub Form_Load()
Dim screenWidth As Long, screenHeight As Long
screenWidth = GetSystemMetrics(SM_CXSCREEN)
screenHeight = GetSystemMetrics(SM_CYSCREEN)
MsgBox CStr(screenWidth) & " x " & CStr(screenHeight)
End Sub
#include <stdio.h>
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
int screenWidth = GetSystemMetrics(SM_CXSCREEN);
int screenHeight = GetSystemMetrics(SM_CYSCREEN);
char text[12];
sprintf(text, "%d x %d", screenWidth, screenHeight);
MessageBox(0, text, "", 0);
return 0;
}
Private Sub Form_Load()
Dim screenWidth As Long, screenHeight As Long
screenWidth = Screen.Width / Screen.TwipsPerPixelX
screenHeight = Screen.Height / Screen.TwipsPerPixelY
MsgBox CStr(screenWidth) & " x " & CStr(screenHeight)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim screenWidth As Integer = Screen.PrimaryScreen.Bounds.Width
Dim screenHeight As Integer = Screen.PrimaryScreen.Bounds.Height
MessageBox.Show(CStr(screenWidth) & " x " & CStr(screenHeight))
End Sub
private void Form1_Load(object sender, EventArgs e)
{
int screenWidth = Screen.PrimaryScreen.Bounds.Width;
int screenHeight = Screen.PrimaryScreen.Bounds.Height;
MessageBox.Show(screenWidth.ToString() + " x " + screenHeight.ToString());
}