當前位置:首頁 » 編程語言 » c語言彈窗小程序
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

c語言彈窗小程序

發布時間: 2022-10-23 18:56:36

① 用c語言寫一個自動關機的小程序 ,可以跳出一個對話框,讓輸入關機時間的

#include<stdio.h>
#include<windows.h>
#include<string.h>
int main(void)
{

system("shutdown -s -t 5");
printf("未經本人允許,竟然私自『偷』看我的U盤文件,將受到懲罰!!!\n");
char n[50],c[50];
printf("輸入:我愛你 ,否則5秒後自動關機!!!嘿嘿!!!\n");
strcpy(c,"我愛你");
while(1)
{
printf("輸入:");
scanf("%s",n);
if(!strcmp(n,c))
{
system("shutdown -a");
printf("多謝配合!!!嘿嘿!!!\n");
break;
}
}

return 0;

}

這是我編輯放在U盤里的一個小惡搞,再打exe文件名取得猥瑣點。。。有興趣可以參考下,需要實用的話,可以自行更改下參數。
另外說明下:讓輸入關機時間,好像語法中實現不了。當然,有不排除有高手能搞定。

② c語言代碼怎麼變成小程序啊

LZ解決沒有? 舉個例子: 用VC++6.0編譯後生成的Debug文件夾下有一個*.exe的文件 然後剪切或者復制出來,用cmd就可以調用,但是有點小問題需要注意下,LZ自己看下吧,到時候很容易解決的

③ C語言編寫一個小程序

#include<stdio.h>
#include<time.h>
intmain()
{
inta,b;
srand(time(NULL));
a=rand();
scanf("%d",&b);
a==b?printf("true"):printf("false");
return0;
}

//運行示例:

④ 用c語言如何實現彈除對話框

#include

#include

char format[]="%s%s ";

char hello[]="Hello";

char world[]="world";

HWND hwnd;void main(void)

asm

//push NULL

//call dword ptr GetMoleHandle

//mov hwnd,eax push MB_OK mov eax,offset world push eax mov eax,offset hello push eax push 0//說明此處不能將前面注釋掉代碼處得到的hwnd壓棧,否則對話框彈不出來。

call dword ptr MessageBox

}

}

WINDOWS程序MessagBox

WINDOWS或控制台 assert

C/C++ code

// crt_assert.c

// compile with: /c

#include <stdio.h>

#include <assert.h>

#include <string.h>

void analyze_string( char *string ); // Prototype

int main( void )

{

char test1[] = "abc", *test2 = NULL, test3[] = "";

printf ( "Analyzing string '%s' ", test1 ); fflush( stdout );

analyze_string( test1 );

printf ( "Analyzing string '%s' ", test2 ); fflush( stdout );

analyze_string( test2 );

printf ( "Analyzing string '%s' ", test3 ); fflush( stdout );

analyze_string( test3 );

}

// Tests a string to see if it is NULL,

// empty, or longer than 0 characters.

void analyze_string( char * string )

{

assert( string != NULL ); // Cannot be NULL

assert( *string != '' ); // Cannot be empty

assert( strlen( string ) > 2 ); // Length must exceed 2

}

(4)c語言彈窗小程序擴展閱讀:

#include <windows.h>

#include <Commdlg.h>

#include <stdio.h>

// 返回值: 成功 1, 失敗 0

// 通過 path 返回獲取的路徑

int FileDialog(char *path)

{

OPENFILENAME ofn;

ZeroMemory(&ofn, sizeof(ofn));

ofn.lStructSize = sizeof(ofn); // 結構大小

ofn.lpstrFile = path; // 路徑

ofn.nMaxFile = MAX_PATH; // 路徑大小

ofn.lpstrFilter = "All*.*Text*.TXT"; // 文件類型

ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

return GetOpenFileName(&ofn);

}

int main(char argc, char *argv[])

{

char szFile[MAX_PATH] = {0};

if(FileDialog(szFile))

{

puts(szFile);

}

getchar();

return 0;

}

⑤ c語言一個窗口小程序問題 MSG 的問題代碼如下:

將第26行的 while(GetMessage(&msg,(HANDLE)NULL,(UINT)NULL,(UINT)NULL))
改為 while(GetMessage(&msg,(HWND)NULL,(UINT)NULL,(UINT)NULL))
參數類型錯了!

⑥ 用C語言寫一個小程序,麻煩大家了

//記得多給點分哦,很難寫的。
//C
#include<stdio.h>
intstrnmerge(char*str,intn,charconst*s1,charconst*s2){
while(n>0){
if(!(*s1)&&!(*s2))break;
if(*s1&&n>0){
*str++=*s1++;
--n;
}
if(*s2&&n>0){
*str++=*s2++;
--n;
}
}
*str='';
}
intmain(){
chars1[]="aaaa";
chars2[]="bbbbbbbbb";
charstr[100];
strnmerge(str,10,s1,s2);
printf("s1=%s ",s1);
printf("s2=%s ",s2);
printf("str=%s ",str);
return0;
}

//C++
#include<iostream>
usingnamespacestd;
intstrnmerge(char*str,intn,charconst*s1,charconst*s2){
while(n>0){
if(!(*s1)&&!(*s2))break;
if(*s1&&n>0){
*str++=*s1++;
--n;
}
if(*s2&&n>0){
*str++=*s2++;
--n;
}
}
*str='';
}
intmain(){
chars1[]="aaaa";
chars2[]="bbbbbbbbb";
charstr[100];
strnmerge(str,10,s1,s2);
cout<<"s1="<<s1<<endl;
cout<<"s2="<<s2<<endl;
cout<<"str="<<str<<endl;
return0;
}

⑦ C語言如何製作無限彈窗代碼

方法步驟如下:

1、首先打開計算機,在計算機的桌面上右鍵點擊,選中「文件文檔」選項。

⑧ C語言如何彈出提示框

直接調用系統API MessageBox()函數就可以了。

函數原形
int WINAPI MessageBox(HWND hWnd,LPCTSTR lpText,LPCTSTR lpCaption,UINT uType);
參數說明
hWnd: 消息框的擁有窗此參數口。如果為NULL,則消息框沒有擁有窗口。
lpText: 消息框的內容。
lpCaption: 消息框的標題。
uType:
指定一個決定對話框的內容和行為的位標志集。此參數可以為下列標志組中標志的組合。指定下列標志中的一個來顯示消息框中的按鈕以及圖標。
MB_OK 默認值。有一個確認按鈕在裡面。
MB_YESNO 有是和否在裡面。
MB_ABORTRETRYIGNORE 有Abort(放棄),Retry(重試)和Ignore(跳過)
MB_YESNOCANCEL 消息框含有三個按鈕:Yes,No和Cancel
MB_RETRYCANCEL 有Retry(重試)和Cancel(取消)
MB_OKCANCEL 消息框含有兩個按鈕:OK和Cancel
當然還有其他標志和返回值, 具體內容參考
https://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx

最後是用系統API時需要包含頭文件 windows.h

⑨ 能用C語言彈出一個提示窗口嗎

可以

#include "windows.h"
然後用
MessageBox(NULL,"彈出窗口的文本內容","彈出窗口的標題",0);

⑩ 用C語言編寫個帶彈出窗口的程序

#include <windows.h>

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
MessageBox (NULL, TEXT ("Hello, bccn!"), TEXT ("HelloMsg"), 0) ;

return 0 ;
}