|
Thanks! that was easy
|
|
|
|
|
i'm starting to make a remote access control program, what should i need to learn to develope such program? any suggestions would be appreciated!
|
|
|
|
|
Kinda sounds like a RAT (Remote Administrations Tool) to me, if its anything like that then the first thing you need to learn is how to use sockets
|
|
|
|
|
I would like to know how to save BMP image from Clipboard to the disk
Michael Geffen
|
|
|
|
|
Hi!
You can use this. You can get the hdc by GetDC...
<br />
int Screenshotal(HDC hdc, char *pszflname)<br />
{<br />
HDC memdc;<br />
HANDLE hfl;<br />
DWORD dwBytes, dwWidth, dwHeight, dwNumColors, dwBPP, ColorSize;<br />
void *pBits;<br />
HBITMAP hbmp;<br />
BITMAPFILEHEADER fileheader;<br />
BITMAPINFOHEADER infoheader;<br />
RGBQUAD colors[256];<br />
BITMAPINFO bmpinfo;<br />
HGDIOBJ hret;<br />
<br />
dwWidth = GetDeviceCaps(hdc, HORZRES);<br />
dwHeight = GetDeviceCaps(hdc, VERTRES);<br />
dwBPP = GetDeviceCaps(hdc, BITSPIXEL);<br />
if (dwBPP <= 8)<br />
dwNumColors = 256;<br />
else<br />
dwNumColors = 0;<br />
if (!(memdc = CreateCompatibleDC(hdc)))<br />
return (0);<br />
bmpinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);<br />
bmpinfo.bmiHeader.biWidth = dwWidth;<br />
bmpinfo.bmiHeader.biHeight = dwHeight;<br />
bmpinfo.bmiHeader.biPlanes = 1;<br />
bmpinfo.bmiHeader.biBitCount = (WORD)dwBPP;<br />
bmpinfo.bmiHeader.biCompression = BI_RGB;<br />
bmpinfo.bmiHeader.biSizeImage = 0;<br />
bmpinfo.bmiHeader.biXPelsPerMeter = 0;<br />
bmpinfo.bmiHeader.biYPelsPerMeter = 0;<br />
bmpinfo.bmiHeader.biClrUsed = dwNumColors;<br />
bmpinfo.bmiHeader.biClrImportant = dwNumColors;<br />
hbmp = CreateDIBSection(hdc, &bmpinfo, DIB_PAL_COLORS, &pBits, NULL, 0);<br />
if (!hbmp)<br />
{<br />
DeleteDC(memdc);<br />
return (0);<br />
}<br />
hret = SelectObject(memdc, hbmp);<br />
if (!hret || (hret == HGDI_ERROR))<br />
{<br />
DeleteDC(memdc);<br />
return (0);<br />
}<br />
if (!BitBlt(memdc, 0, 0, dwWidth, dwHeight, hdc, 0, 0, SRCCOPY))<br />
{<br />
DeleteDC(memdc);<br />
return (0);<br />
}<br />
if (dwNumColors)<br />
dwNumColors = GetDIBColorTable(memdc, 0, dwNumColors, colors);<br />
fileheader.bfType = 0x4D42;<br />
ColorSize = dwNumColors * sizeof(RGBQUAD);<br />
fileheader.bfSize = ((dwWidth*dwHeight*dwBPP) >> 3) + ColorSize + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);<br />
fileheader.bfReserved1 = fileheader.bfReserved2 = 0;<br />
fileheader.bfOffBits = ColorSize + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);<br />
infoheader.biSize = sizeof(BITMAPINFOHEADER);<br />
infoheader.biWidth = dwWidth;<br />
infoheader.biHeight = dwHeight;<br />
infoheader.biPlanes = 1;<br />
infoheader.biBitCount = (WORD)dwBPP;<br />
infoheader.biCompression = BI_RGB;<br />
infoheader.biSizeImage = infoheader.biClrImportant = 0;<br />
infoheader.biXPelsPerMeter = infoheader.biYPelsPerMeter = 0;<br />
infoheader.biClrUsed = dwNumColors;<br />
hfl = CreateFile(pszflname, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);<br />
if (hfl == INVALID_HANDLE_VALUE)<br />
{<br />
DeleteObject(hbmp);<br />
{<br />
DeleteDC(memdc);<br />
return (0);<br />
}<br />
}<br />
WriteFile(hfl, &fileheader, sizeof(BITMAPFILEHEADER), &dwBytes, 0);<br />
WriteFile(hfl, &infoheader, sizeof(BITMAPINFOHEADER), &dwBytes, 0);<br />
if (!dwNumColors)<br />
WriteFile(hfl, colors, ColorSize, &dwBytes, 0);<br />
ColorSize = (dwWidth * dwHeight * dwBPP) >> 3;<br />
WriteFile(hfl, pBits, ColorSize, &dwBytes, 0);<br />
CloseHandle(hfl);<br />
DeleteObject(hbmp);<br />
DeleteDC(memdc);<br />
return (1);<br />
}
Well... I am a beginner ...
|
|
|
|
|
;) ;)Dear Scolinks
I alredy used your code and it is works nice , thanks !!
|
|
|
|
|
"Avalon is the new Windows Desktop Composition Engine that replaces the old GDI and GDI+."
Is that totally impossible to replace GDI with an Avalon-like desktop compositing engine for older windows versions (name it: 2k/xp)?
What do you think? Won't Microsoft provide something like this before the release of longhorn?
|
|
|
|
|
mkristof wrote:
"Avalon is the new Windows Desktop Composition Engine that replaces the old GDI and GDI+."
Where did you get this from?
mkristof wrote:
Is that totally impossible to replace GDI with an Avalon-like desktop compositing engine for older windows versions (name it: 2k/xp)?
What does "that" mean in this context? I strongly doubt a third party (assuming Avalon is a 3rd party product), will ever be able to replace the GDI. This is a good thing.
mkristof wrote:
What do you think? Won't Microsoft provide something like this before the release of longhorn?
I think Microsoft is better off not providing this. Unless they have a really good stategy in place to tackle such an issue. Imagine the video card driver support each new vendor would need to provide. Its against the principle of providing a universal GDI in the first place.
Bikram Singh
|
|
|
|
|
bikram singh wrote:
Where did you get this from?
http://www.codeproject.com/scrapbook/PDC2003.asp
bikram singh wrote:
What does "that" mean in this context? I strongly doubt a third party (assuming Avalon is a 3rd party product), will ever be able to replace the GDI. This is a good thing.
"that" means nothing. It's my poor english... please read "that" as "it" (is it possible to replace GDI...?)
bikram singh wrote:
I think Microsoft is better off not providing this. Unless they have a really good stategy in place to tackle such an issue. Imagine the video card driver support each new vendor would need to provide. Its against the principle of providing a universal GDI in the first place.
I've read somewhere Apple's compositor engine for Mac OS X is "modern". There are no special hardware requirements for Mac OS X (except PPC is a totally different platform but there is no need to use special video cards with OS X). I know, Avalon will be more complex than the present engine for OS X but i think they should provide a new ("modern") compositor engine for latest Windows OS.
I just don't understand this situation. Microsoft Windows is the most popular desktop OS but it's interface is very obsolete.
|
|
|
|
|
for( unsigned int a = 0; a < strlen(message); a++ )
{
temp = VkKeyScan(message[a]);
if( GetKeyState( 20 ) && islower(message[a]) )
{
keybd_event( VK_SHIFT, NULL, 1, 0 );
keybd_event( temp, NULL, 1, 0 );
keybd_event( temp, NULL, 3, 0 );
keybd_event( VK_SHIFT, NULL, 3, 0 );
}
else if( !GetKeyState( 20 ) && isupper(message[a]) )
{
keybd_event( VK_SHIFT, NULL, 1, 0 );
keybd_event( temp, NULL, 1, 0 );
keybd_event( temp, NULL, 3, 0 );
keybd_event( VK_SHIFT, NULL, 3, 0 );
}
else
{
keybd_event( temp, NULL, 1, 0 );
keybd_event( temp, NULL, 3, 0 );
}
Sleep( 100 );
}
ok, i have solved the problem with Caps lock intefereing but i cant seem to keep shift from interfeering anyone know what i can do to keep it from interfeering?
|
|
|
|
|
Actually, no. But I checked the documentation for SendInput, which ought to have the same problem. I quote the following:
"Therefore, if the user has any keys pressed when you call this function, they might interfere with the events that this function generates. If you are concerned about possible interference, check the keyboard's state with the GetAsyncKeyState function and correct as necessary."
I did a quick test, but could not get rid of the spurious upper character - but you could at least experiment along those lines.
|
|
|
|
|
i just had an idea, i could disable the keyboard while the keys are being simulated when they're finished being simulated i could re-enable the keyboard
only one problem, i dont know how to disable the keyboard. and cant seem to find out how
|
|
|
|
|
I think that would be both hostile and massive overkill in a multitasking environment. A better idea would probably be to reset the key state as for SendInput . I suspect that a search on MSDN for GetAsyncKeyState and the other interesting functions ought to give some code samples that could be used.
|
|
|
|
|
Hi!
I'm currently making my first steps with Direct3D9.
I have a project running quite fine, I can render some triangles etc.
But after several executions of my program I get the following linker error when I want to compile:
DXProject fatal error LNK1201: error writing to program database 'e:\C++\DXProject\Release\DXProject.pdb'; check for insufficient disk space, invalid path, or insufficient privilege
what am I doing wrong? I need to restart my IDE in order to compile properly again.
thanks in advance
modified 12-Sep-18 21:01pm.
|
|
|
|
|
It has been 2years since I wrote anything in c profesionaly...
so pardon the dry info..
the problem is that LINK could not write to the program database (PDB) for the output file.
Possible causes
File is corrupt. Delete the PDB file and relink.
Not enough disk space to write the file.
Drive is not available, possibly due to a network problem.
The debugger is active on the program you are trying to link
There is a limit of 4096 modules (.obj files) in a PDB file. The file also has a total size limit of approximately 64 MB.
RESOLUTION
There are several ways to reduce the size of PDB files:
Build some of the source files with the /Zd switch (line numbers only).
Build some of the source files as separate dynamic-link libraries (DLLs) instead of static libraries.
Build some of the source files without debug information.
Try the compiler switch /Fd"myproject.pdb" (including the quotation marks).
It is Illogical to define an inventor by his invention
|
|
|
|
|
Im making a key logger, and i want to give the user the option to keep it from showing up in CTRL+ALT+DEL menu
i have seen some VB examples that use an imported function from KERNEL32.DLL (RegisterServiceProcess)
can some one show how to use this in C++?
or possibly another way to hide it?
|
|
|
|
|
Use the VC++ KeyBoardHook and each time the ctrl+alt+del is pressed cancel it.
Learn more about windows hooks.
gabby
|
|
|
|
|
How can I put a TreeCtrl into a ListCtrl as a colunm Item? Each tree node controls a row of the list.Expand or collapse the tree also expand or collapse the coresponding row of the list. There is a example from CuteFTP.The Queue Window of CuteFTP is what exactly I need. I have no idea.
Could you give me a help? Many thanks.
Alick
|
|
|
|
|
This would require custom draw features if you want a real tree view in the list view.
The CuteFTP feature you talk of, can be accomplished by intercepting the usual selection/keydown/keyup/mouse messages that a listview provides.
Bikram Singh
|
|
|
|
|
Hello every body.
I am developing an application with clipboard supporting. When users press Ctrl+C or Ctrl+X, the application copies three types of data into clipboard: application defined data, text only data, windows metafile data.
I've used COleDataSource to implement that capacities. The below is my code:
CSharedFile sf(GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT);
CArchive ar (&sf, CArchive::store);
ar.Close();
DWORD dwLen = (DWORD) sf.GetLength();
HGLOBAL hMem = sf.Detach();
COleDataSource* pSource=NULL;
if (hMem){
hMem = ::GlobalReAlloc(hMem, dwLen, GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT);
if (hMem){
pSource = new COleDataSource();
pSource->CacheGlobalData(CF_APPLICATIONDEFINED, hMem);
}
}
CSharedFile txtsf(GMEM_ZEROINIT|GMEM_DDESHARE|GMEM_MOVEABLE);
txtsf.Write((LPCTSTR)st, st.GetLength()+1);
dwLen = (DWORD) txtsf.GetLength();
hMem = txtsf.Detach();
if (hMem){
hMem = ::GlobalReAlloc(hMem, dwLen, GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT);
if (hMem){
if (!pSource)
pSource = new COleDataSource();
pSource->CacheGlobalData(CF_TEXT, hMem);
}
}
CDC DC;
CDC* pDC = NULL;
CMetaFileDC MetaDC;
DC.CreateCompatibleDC(NULL);
CRect rect(0,0,width, height);
CRect rectMeta(0,0,0,0);
rectMeta.left = MulDiv(rect.left*100, DC.GetDeviceCaps(HORZSIZE), DC.GetDeviceCaps(HORZRES));
rectMeta.top = MulDiv(rect.top*100, DC.GetDeviceCaps(VERTSIZE), DC.GetDeviceCaps(VERTRES));
rectMeta.right = MulDiv(rect.right*100, DC.GetDeviceCaps(HORZSIZE), DC.GetDeviceCaps(HORZRES));
rectMeta.bottom = MulDiv(rect.bottom*100, DC.GetDeviceCaps(VERTSIZE), DC.GetDeviceCaps(VERTRES));
MetaDC.CreateEnhanced(&DC, NULL, rectMeta, _T("Anything\0Image\0\0"));
MetaDC.SetAttribDC(DC.m_hDC);
MetaDC.SetMapMode(MM_TEXT);
pDC = &MetaDC;
CBrush brush;
brush.CreateSysColorBrush(COLOR_WINDOW);
pDC->FillRect(rect, &brush);
brush.DeleteObject();
Draw(pDC);
STGMEDIUM std;
std.tymed=TYMED_ENHMF;
std.hEnhMetaFile=MetaDC.CloseEnhanced();
if (!pSource)
pSource = new COleDataSource();
pSource->CacheData(CF_ENHMETAFILE, &std);
pSource->SetClipboard();
Everything worked well but when application was closed, an exception occured in an ole module. After application has been closed, I could not paste the image to Paint either. But I could paste text to Notepad or ran application again and pasted to it well.
I hope you could understand what I mean.
Does anyone show me why?
Thanks for reading.
|
|
|
|
|
Hello!
I have tried to Close my SDI Apllication with Destroy(); or with OnClose(); but it didnt works!
Does somebody know what function i have to use?
Thanks a lot!
Ronny
|
|
|
|
|
Try CMainFrame's PostMessage(WM_CLOSE)
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
Hello ant thanks!!
But it didnt works, is there another way to close the App?
|
|
|
|
|
You might need to process the WM_CLOSE message.
void CMainFrame::OnClose()
{
CFrameWnd::OnClose();
return;
}
|
|
|
|
|
Thanks that was a good idea, but i have forgotten to tell i need a function wich i can start in the View Class. I have tried to make a public function in Mainframe and use it in the View Class and it was complile able but it also didnt works...
|
|
|
|
|