'델파이블로그'에 해당되는 글 5건
- 2020.04.13 :: [C#] TXT 불러오기 소스
- 2020.04.13 :: [C#] 네이버 카페 인증소스
- 2020.04.12 :: [DelPhi] 자신의 개인 DLL 제작한 후 사용해보기 소스
- 2020.04.12 :: [DelPhi] 델파이 랜덤문자 만들기 두번째방법
- 2020.04.12 :: [DelPhi] 델파이 랜덤문자 만들기 첫번째방법
//열기창 생성
OpenFileDialog oDialog = new OpenFileDialog();
oDialog.Filter = "텍스트 파일|*.txt";
//열기창 띄우고 내용 반환
if (oDialog.ShowDialog() == DialogResult.OK)
{
string a = System.IO.File.ReadAllText(oDialog.FileName, Encoding.Default);
}
'C샵' 카테고리의 다른 글
[C#] C# 데이터 타입 배워보기 (종류) (1) | 2020.04.16 |
---|---|
[C#] C#의 버전 알아보자 (0) | 2020.04.16 |
[C#] C#이란 무엇일까? 기초알아보기 (1) (0) | 2020.04.16 |
[C#] 네이버 카페 인증소스 (0) | 2020.04.13 |
// 상단에 using지시문 추가
using WinHttp; // 오류가 뜰 경우 참고 추가로 winhttp.dll 추가하시면 됩니다.
// 추가 방법은 찾아보기 - C:\windows\System32 에서 저 winhttp 검색하시면 됩니다. (32비트 기준)
// 네이버 계정 및 카페 인증
bool NaverLogin(string ID, string PW)
{
WinHttpRequest WinHttp = new WinHttpRequest();
WinHttp.Open("POST", "https://nid.naver.com/nidlogin.login", false);
WinHttp.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded");
WinHttp.SetRequestHeader("Referer", "https://nid.naver.com/nidlogin.login");
WinHttp.Send("enctp=2&url=http://www.naver.com&enc_url=http://www.naver.com&postDataKey=&saveID=0&nvme=0&smart_level=1&id=" + ID + "&pw=" + PW);
WinHttp.WaitForResponse();
WinHttp.Open("GET", "http://cafe.naver.com/"); // 해당 카페 주소 입력
WinHttp.Send("");
WinHttp.WaitForResponse();
string result = Encoding.Default.GetString(WinHttp.ResponseBody);
if (result.IndexOf("카페멤버") == -1) // 이건 WinHttp.ResponseText.IndexOf("카페멤버") 이렇게 사용하면 오류가 뜨더라구요
{
return false; // 카페 가입이 되어있으면 저 "카페멤버" 라는 글자가 표시되지 않습니다.
}
else
{
return true; // 카페 가입이 되어있지않으면 저 "카페멤버" 라는 글자가 표시됩니다.
}
}
이렇게 하시고 버튼 이벤트에
// NaverLogin 이 false 값일 경우 (가입 되어있을 경우)
// NaverLogin 이 true 값일 경우 (가입 되어있지 않을 경우)
if (NaverLogin(textBox1.Text, textBox2.Text) == false)
{
// false 값이면 성공
MessageBox.Show("네이버 인증에 성공하였습니다.", "성공!", MessageBoxButtons.OK);
}
else
{
// true 값이면 실패
MessageBox.Show("네이버 인증에 실패하였습니다.", "실패!", MessageBoxButtons.OK);
}
'C샵' 카테고리의 다른 글
[C#] C# 데이터 타입 배워보기 (종류) (1) | 2020.04.16 |
---|---|
[C#] C#의 버전 알아보자 (0) | 2020.04.16 |
[C#] C#이란 무엇일까? 기초알아보기 (1) (0) | 2020.04.16 |
[C#] TXT 불러오기 소스 (0) | 2020.04.13 |
{ 여기서 부터 dll 작성부분이다 }
{ 여기서 두함수가 DLL 함수가 된다 }
library Firstdll;
uses
Windows;
function Triple( N : Integer) : Integer; stdcall;
begin
MessageBox(0,'Triple function called',
'First Dll',mb_Ok);
Result := N * 3;
end;
function Double( N : Integer) : Integer; stdcall;
begin
MessageBox(0,'Double function called',
'First Dll',mb_Ok);
Result := N * 2;
end;
exports
Triple , Double;
begin
end.
{ 여기까지가 Dll 작성 루틴이다 }
{ 여기서 부터는 DLL 에 있는 함수를 호출하는것을 보여주는 예이다.}
unit dllcall;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Spin;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
SpinEdit1: TSpinEdit;
SpinEdit2: TSpinEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
{ DLL 함수를 선언한다 }
function Double( N : Integer) : Integer;
stdcall; external 'FirstDll.dll';
function Triple( N : Integer) : Integer;
stdcall; external 'FirstDll.dll';
implementation
{$R *.DFM}
{DLL 함수의 호출}
procedure TForm1.Button1Click(Sender: TObject);
begin
SpinEdit1.Value := Double(SpinEdit1.Value);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
SpinEdit2.Value := Triple(SpinEdit2.Value);
end;
end.
----- Dfm 파일 -----
object Form1: TForm1
Left = 200
Top = 108
Width = 328
Height = 156
Caption = 'Form1'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 24
Top = 24
Width = 75
Height = 25
Caption = 'Double'
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 24
Top = 80
Width = 75
Height = 25
Caption = 'Triple'
TabOrder = 1
OnClick = Button2Click
end
object SpinEdit1: TSpinEdit
Left = 144
Top = 24
Width = 121
Height = 22
MaxValue = 0
MinValue = 0
TabOrder = 2
Value = 0
end
object SpinEdit2: TSpinEdit
Left = 144
Top = 80
Width = 121
Height = 22
MaxValue = 0
MinValue = 0
TabOrder = 3
Value = 0
end;
end;
'DelPhi' 카테고리의 다른 글
[DelPhi] Edit에 버튼을 넣어보자 소스 (0) | 2020.04.12 |
---|---|
[DelPhi] 간단하게 dll로 값을 저장&불러오기 (0) | 2020.04.12 |
[DelPhi] 델파이 랜덤문자 만들기 두번째방법 (0) | 2020.04.12 |
[DelPhi] 델파이 랜덤문자 만들기 첫번째방법 (0) | 2020.04.12 |
[DelPhi] 델파이 캡션명 인젝터 구동하기 소스 (0) | 2020.04.12 |
<?
function random_string() {
$random= "";
for( $i=0; $i<rand(7,8); $i++) {
if(rand(0,1)) {
$random .= rand(0, 9);
} else {
$random .= chr(rand(98, 122));
}
}
return $random;
}
print_r(random_string());
?>
'DelPhi' 카테고리의 다른 글
[DelPhi] Edit에 버튼을 넣어보자 소스 (0) | 2020.04.12 |
---|---|
[DelPhi] 간단하게 dll로 값을 저장&불러오기 (0) | 2020.04.12 |
[DelPhi] 델파이 랜덤문자 만들기 첫번째방법 (0) | 2020.04.12 |
[DelPhi] 델파이 캡션명 인젝터 구동하기 소스 (0) | 2020.04.12 |
[DelPhi] 델파이 체크 프로세스 함수 소스 (0) | 2020.04.12 |
//랜덤 문자 만들기
function random_string($len) {
$str = '1234567890abcdefghijklmnopqrstuvwxyz';
$strlen = strlen($str) -1;
$return = '';
for ($i = 0; $i < $len; $i++) {
$rand = rand(0, $strlen);
$return .= $str[$rand];
}
return $return;
}
'DelPhi' 카테고리의 다른 글
[DelPhi] 간단하게 dll로 값을 저장&불러오기 (0) | 2020.04.12 |
---|---|
[DelPhi] 델파이 랜덤문자 만들기 두번째방법 (0) | 2020.04.12 |
[DelPhi] 델파이 캡션명 인젝터 구동하기 소스 (0) | 2020.04.12 |
[DelPhi] 델파이 체크 프로세스 함수 소스 (0) | 2020.04.12 |
[DelPhi] 델파이 폼이란 무엇인가? (기본메뉴알아보기) (0) | 2020.04.12 |