|
Thank u Mr christian for u help ..i realy apreciate u time and u opinion..i have used so simple code that make user insert username && password but my prob is i cant make password invisible for the user ( appears as stars shape)
#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
void main()
{
string str1,str2;
string username ("ourteam");
string password ("cool");
cout<<"plz enter username"<<endl;
cin="">>str1;
cout<<"plz enter password"<<endl;
cin="">>str2;
if(str1==username && str2==password)
{
cout<<"hello guys"<
|
|
|
|
|
#include <conio.h>
string s;
char c;
while ((c = getch()) != 13)
{
s += c;
cprintf("*");
}
Now "s" contains the string user entered.
Do this for both username and password.
this is this.
|
|
|
|
|
Hi,
I need an efficient/simple password encryption/decryption algorithm/code so that I can use in my VC++ application.
I actually looked in the net a found various utilities but not been able to decide which one to go for?
Thanks,
|
|
|
|
|
|
I tried both the links but most of the algorithms which use XOR do not work for passwords like abcd1, abcde1, abcdef12, abcdef12ghijklmnop etc.
Do you have any other algorithms which will work for all the characters? Imean encrypt/decrypt any given data?
|
|
|
|
|
Anonymous wrote:
Do you have any other algorithms which will work for all the characters? Imean encrypt/decrypt any given data?
this link will help
http://www.codeproject.com/cpp/#Cryptography[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hello all,
I'm working on a school project to make a security program. I need to get the MAC Address from the computer. That is the "Physical Address" when you type "ipconfig/all" in MSDOS command prompt.
It is urgent and I have spent pretty much time there, but still don't know what to do. I am an amateur in programming. I'd greatly appreciate your opinion. Thanks.
~~~ Landy
|
|
|
|
|
|
I have addded a toolbar in the OnCreate method of CMainFrame as below
if (!m_UICtrlsBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_RIGHT
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_UICtrlsBar.LoadToolBar(IDR_TOOLBAR_DRAW))
{
TRACE0("Failed to OSD Controls ToolBar\n");
return -1;
}
But the handlers for this toolbar wont work when child windows are restored or maximized. In other words - in the presence of child view windows the message handler for the toolbar is not invoked. IF I minimize/close the child windows the handler works.I have posted this several times.I am still unable to figure out the actual problem.
Please let me know if my problem is not clear.
laiju
|
|
|
|
|
have addded a toolbar in the OnCreate method of CMainFrame as below
if (!m_UICtrlsBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_RIGHT
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_UICtrlsBar.LoadToolBar(IDR_TOOLBAR_DRAW))
{
TRACE0("Failed to OSD Controls ToolBar\n");
return -1;
}
IF I close the child windows the handler works.The handler wont work if the child window is minimized or restored either.
laiju
|
|
|
|
|
Any chance you have handlers for the same commands in either the view, frame or document of the child window? MFC's command routing give those a chance to handle commands before the main frame...
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I have double checked this.
The command ID_VIEW_DRAWTOOLBAR is not used anywhere in the project except for calling the handler OnDrawToolBar and update handler OnUpdateDrawToolBar in the mainframe
laiju
|
|
|
|
|
Wild guess, but I'd check if ID_VIEW_DRAWTOOLBAR happens to be defined with the same number as some other command...
Otherwise, I suggest setting a breakpoint in CMDIFrameWnd::OnCmdMsg() (it's in MFC's winmdi.cpp) with a condition (nID==ID_VIEW_DRAWTOOLBAR) and following the execution from there through the debugger to see how the message is routed and where it's being handled.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
hi
i had made an application in visuall c++, which counts the numners of text files in drive c.i want to asssociate with the web page. somebody told me that u make the active X control link it to the web page.
my question is how to link the web page with active X control and can i use the MFC activex control wizard to make the such active x control.
ddd
|
|
|
|
|
http://www.download.com/ActiveX-Control-Pad/3000-2406_4-861343.html
|
|
|
|
|
Hi,
I am new to MFC and Windows Service. I am trying write a Windows Service Program, its job is to take Screen Capture once in while and save it as a bitmap. For this I am using BitBlt() function. It is failing with "Invalid Handle", but I checked all the handles and they are valid.
I used same code to capture screen which uses BitBlt in a normal Windows apllication and it is working fine.
So , BitBlt is only failing in Windows Service.
Please help me to resolve this issue.
Thanks
VV
|
|
|
|
|
Please post some code. There are so many articles on capturing the sceen that it will probably be nothing new. It may be just a minor mistake in the code.
The smaller the example the better.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
vegeakhil wrote:
I am trying write a Windows Service Program, its job is to take Screen Capture once in while and save it as a bitmap
Is your service is DESKTOP INTERECTIVE SERVICE? if not, you always get BLANK IMAGE or Invalid HANDLE
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Yes, the service is created with SERVICE_INTERACTIVE_PROCESS property. Give me some more time I will post the code also. Thanks
|
|
|
|
|
The same Screen Capture function is working fine if I call from simple application (normal application not a service application). So I am thinking it is something to do with service.
|
|
|
|
|
Hi Guys
Pls help me...the code is , just to remind you again, if I call this function from simple application it is fine, but if I call from windows service, BitBlt is failing with "Invalid Handle".
Thanks
BOOL CFrameBuffer::CaptureScreen(CRect rectScreen, BYTE *scrBuff)
{
HBITMAP hDesktopCompatibleBitmap=NULL;
HDC hDesktopCompatibleDC=NULL;
HDC hDesktopDC=NULL;
HWND hDesktopWnd=NULL;
int nHeight=rectScreen.bottom-rectScreen.top;/GetSystemMetrics(SM_CXSCREEN);
int nWidth=rectScreen.right-rectScreen.left;//GetSystemMetrics(SM_CYSCREEN);
hDesktopWnd=GetDesktopWindow();
hDesktopDC=::GetDC(NULL);
hDesktopCompatibleDC=CreateCompatibleDC(hDesktopDC);
hDesktopCompatibleBitmap=CreateCompatibleBitmap(hDesktopDC,nWidth,nHeight);
BOOL bRet = FALSE;
HBITMAP oldbitmap;
oldbitmap = (HBITMAP)SelectObject(hDesktopCompatibleDC,hDesktopCompatibleBitmap);
if(hDesktopCompatibleDC && hDesktopDC)
{
bRet = BitBlt(hDesktopCompatibleDC,0,0,nWidth,nHeight,hDesktopDC,0,0,SRCCOPY);
}
OPENFILENAME ofn;
char szFileName[512]; szFileName[0]='\0';
ZeroMemory(&ofn,sizeof(ofn));
ofn.lStructSize=sizeof(OPENFILENAME);
ofn.Flags=OFN_HIDEREADONLY|OFN_PATHMUSTEXIST;
ofn.lpstrFilter="Bitmap Files (*.bmp)\0*.bmp\0";
ofn.lpstrDefExt="bmp";
strcpy(szFileName,"C:\\temp\\MyBitmap.bmp");
ofn.lpstrFile=szFileName;
ofn.nMaxFile=512;
CFileFind finder;
if(finder.FindFile(szFileName))
{
DeleteFile(szFileName);
}
SetCursor(LoadCursor(NULL,IDC_WAIT));
BITMAPINFO bi;
void *pBits=NULL;
ZeroMemory(&bi,sizeof(bi));
bi.bmiHeader.biSize=sizeof(bi.bmiHeader);
bi.bmiHeader.biHeight=nHeight;
bi.bmiHeader.biWidth=nWidth;
bi.bmiHeader.biPlanes=1;
bi.bmiHeader.biBitCount=32;//16 bit
bi.bmiHeader.biCompression=BI_RGB;
bi.bmiHeader.biSizeImage=nWidth*nHeight *sizeof(DWORD);
bi.bmiHeader.biHeight = abs(nHeight);
HDC hBmpFileDC=CreateCompatibleDC(hDesktopCompatibleDC);
HBITMAP hBmpFileBitmap=CreateDIBSection(hDesktopCompatibleDC,&bi,DIB_RGB_COLORS,&pBits,NULL,0);
SelectObject(hBmpFileDC,hBmpFileBitmap);
BitBlt(hBmpFileDC,0,0,nWidth,nHeight,hDesktopCompatibleDC,0,0,SRCCOPY);
HANDLE hFile=CreateFile(szFileName,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile!=INVALID_HANDLE_VALUE)
{
DWORD dwRet=0;
BITMAPFILEHEADER bmfHeader;
ZeroMemory(&bmfHeader,sizeof(bmfHeader));
bmfHeader.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER);
bmfHeader.bfSize=bi.bmiHeader.biSizeImage+bmfHeader.bfOffBits;
bmfHeader.bfType='MB';
WriteFile(hFile,&bmfHeader,sizeof(bmfHeader),&dwRet,NULL);
WriteFile(hFile,&bi.bmiHeader,sizeof(bi.bmiHeader),&dwRet,NULL);
WriteFile(hFile,pBits,bi.bmiHeader.biSizeImage,&dwRet,NULL);
CloseHandle(hFile);
AddToMessageLog(" Inside 2 CaptureScreen() is called", 1 );
}
if(scrBuff!=NULL)
{
memcpy(scrBuff,pBits,bi.bmiHeader.biSizeImage);
}
SelectObject(hDesktopCompatibleDC,oldbitmap);
DeleteDC(hBmpFileDC);
DeleteObject(hBmpFileBitmap);
ReleaseDC(hDesktopWnd,hDesktopDC);
return TRUE;
}
|
|
|
|
|
How do i create a function which accepts the same parameters as printf(...)?
In stdio.h, printf is declared as
_CRTIMP int __cdecl printf(const char *, ...); I tried creating a similar function
void test(const char *pStr, ...)
{
printf(pStr);
} However, test(...) display differently from the actual printf(...) call. What am i missing?
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
The ... represents a parameter collection of unknown size. Zero is an acceptable size, so your code ends up calling successfully, but gives printf nothing to do.
This[^] took me ages to find, none of the words I was searching on was specific enough to avoid a thousand hits to basic C++ pages, as ... appears all over the place.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for the link. It certainly explains some 'behind the scene' stuff.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
The fuction below represents that last time I remember having to do this:
int my_printf( const char *format,... )
{
int n=-1;
char *buf=NULL;
size_t size=0;
va_list ap;
va_start( ap,format );
while( n == -1 ) {
size += 128;
if( buf ) free(buf);
buf = (char *)malloc(size);
if( !buf ) n = 0;
else n = _vsnprintf(buf,size,format,ap);
}
va_end(ap);
my_print(buf);
return n;
}
The _vsnprintf() function is still supported by VC6, so it still works. The key is the va_list(), va_start() and va_end() (macros I believe). You'll need to look them all up and may be bring them upto date (this was written around 1992).
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|