|
Thanks...
How to implement this function in a program to read pixel values from a bmp image(eg. purple.bmp)?
Is it ok for you to show me a sample of how this works?
With regards,
Purplee
|
|
|
|
|
To make an example would be large and, actually, your work.
Try it and post when you have problems, start looking in the codeproject and google, there are examples for sure.
Good luck
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hey,
I have a for loop iterating through a Vector. When my program hits certain conditions it needs to do get the value of an element and add one to it.
I tried this but it didn't work:
PrimeNumber(Iter + 1) += 1;
It has to be the next element in the vector and it has to increment that next elements value by one! I've tried declaring an Iterator and using similar code -> *Iter + 1 += 1; but that still doesn't work
Does anyone have any ideas on how to modify the content of a vector? Thanks for all the help in advance I appreciate it!
Michael
|
|
|
|
|
Michael101 wrote: using similar code -> *Iter + 1 += 1; but that still doesn't work
*(Iter + 1) += 1;
Nibu thomas
MVP For VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|
|
You Champion!
|
|
|
|
|
Make sure you don't go beyond/access vector<>::end() when doing +1.
Nibu thomas
MVP For VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|
|
Hello,
How can I attach child window's caption to the frame window in the OnSize() Function?
Right when I maximize the child window it gets maximized without actually the caption getting merged with te frame window.
This is the code in the OnSize()
switch(nType)
{
case SIZE_MAXIMIZED :
{
CRect R;
GetParentFrame()->GetClientRect(R);
MoveWindow(R,true);
break;
}
}
Regards
Prithaa
|
|
|
|
|
prithaa wrote: Right when I maximize the child window it gets maximized without actually the caption getting merged with te frame window.
It's already being done for you if you are using DocView architecture by MFC.
Nibu thomas
MVP For VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|
|
Hello,
Thanks.
No I am nt using Doc -View Architecture and the caption doesn't get merged with the frame window.
What should be done?
Prithaa
|
|
|
|
|
Take a look in BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) . There is where I defined the captions for the "seconday views" on my project.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hello,
Thanks for your reply.
I have the caption initially when the window is created but when I maximize the child window the caption does not appear alongwith the frame window .
What should be done?
Prithaa
|
|
|
|
|
When you maiximize a chil window, it loses its own caption, and share the main frame caption, another thing is to fit the child window to the whole client area of the parent, but maximizing... nothing to do.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
I want to know How Winmain() functions working nature. Also, I want to know from where it is get called?
Sethuraman.K
|
|
|
|
|
Sethuraman.K wrote: I want to know How Winmain() functions working nature. Also, I want to know from where it is get called?
The call stack when execution reaches WinMain is as follows..
WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00141f09, int 1) line 27
WinMainCRTStartup() line 330 + 54 bytes
KERNEL32! 7c816fd7() Press F10(I am using VC6) to see how execution starts in an MFC application. Step through the code. Don't forget there is a global CWinApp object too.
Nibu thomas
MVP For VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|
|
|
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I have implemented a service which will create and restore registry back ups.
Service runs under local system account.
I am able to take backup and restore in admin mode using the service.
But in Guest user mode I m unable to resore the Registry back up.
Any one can help me out in this.
|
|
|
|
|
hm.. i faced a similar problem last week.
The problem is that a windows service runs in a LOCAL SYSTEM account and not in the account in which the user is currently logged in. Hence, if you try to take backups under registry key HKCR then the registry back up would fail.
What you have to do under this condition is write a code something like this:
<br />
HKEY hKey; <br />
long error;<br />
<br />
HANDLE hToken = NULL;<br />
BOOL bEnablePrivilege = TRUE;<br />
<br />
if(GetExplorerToken(hToken))
{<br />
if(hToken != NULL)<br />
{<br />
ImpersonateLoggedOnUser(hToken);<br />
<br />
error = RegOpenKeyEx(HKEY_CURRENT_USER,strRegPath,0,KEY_ALL_ACCESS,&hKey);<br />
<br />
RevertToSelf();<br />
}<br />
}<br />
Now, you can use the hKey obtained to open the required registry key under HKCR and take the back up!!
Cheers
|
|
|
|
|
Hey frnds how multithreading is achieved!
i read 2-3 articles on it..but find those were difficult...
Can u please give me any reference where Multithreading is explained from basic...
Thanks;P;P
|
|
|
|
|
In this function i am trying to disable the dchp in the adapter register key.
Also i am notify the NICs driver that the settings have changed.
bool CTcpIpPropertiesChangerApp::DisableDchp()
{
char szValue[MAX_GUID_STRING_LEN];
CString str,str2;
DWORD pdw=99;
CRegKey key,key2;
for(int flag=1;flag<=100;flag++)
{
str.Format("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\%d",flag);
if(key.Open(HKEY_LOCAL_MACHINE,str,KEY_READ|KEY_WRITE)==ERROR_SUCCESS)
{
key.QueryValue(szValue,"ServiceName",&pdw);
key.Close();
str.Format("SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters\\Interfaces\\%s",szValue);
key.Open(HKEY_LOCAL_MACHINE,str,KEY_WRITE);
key.Open(HKEY_LOCAL_MACHINE,str,KEY_WRITE);
DWORD keyy=0;
::RegSetValueEx(key.m_hKey,"EnableDHCP",0,REG_DWORD,(PBYTE) &keyy,sizeof(PDWORD));
key.Close();
HDEVINFO hDevInfo = SetupDiGetClassDev (NULL,NULL,NULL,DIGCF_ALLCLASSES);
if( INVALID_HANDLE_VALUE == hDevInfo )
{
AfxMessageBox("Error :SetupDiGetClassDevs()");
return FALSE;
}
//An SP_PROPCHANGE_PARAMS structure corresponds to a DIF_PROPERTYCHANGE installation request.
SP_PROPCHANGE_PARAMS spPropChangeParams;
spPropChangeParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
spPropChangeParams.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
spPropChangeParams.Scope = DICS_FLAG_GLOBAL;
spPropChangeParams.StateChange = DICS_DISABLE;
spPropChangeParams.HwProfile = 0;
//An SP_DEVINFO_DATA structure defines a device instance that is a member of a device information set.
SP_DEVINFO_DATA spDevInfoData;
spDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
for (int k=0;SetupDiEnumDeviceInfo(hDevInfo,k,&spDevInfoData);k++)
{
unsigned char GuidString[MAX_GUID_STRING_LEN];
GuidString[MAX_GUID_STRING_LEN - 2] = _T('\0');
for(int l=0;l<max_guid_string_len;l++)
guidstring[l]="szValue[l];
" guid="" ret;
="" uuidfromstring(&guidstring[1],="" &ret);
="" if(spdevinfodata.classguid="=" ret="" )
="" {
="" setupdisetclassinstallparams="" sets="" or="" clears="" class="" install="" parameters="" for="" a="" device="" information="" set="" particular="" element.=""
="" if="" (="" setupdisetclassinstallparams(hdevinfo,="" &spdevinfodata,="" (sp_classinstall_header="" *)&sppropchangeparams,="" sizeof(sppropchangeparams))="=" false)="" setupdidestroydeviceinfolist="" (hdevinfo);
="" return="" false;="" }
="" setupdicallclassinstaller="" calls="" the="" appropriate="" installer,="" and="" any="" registered="" co-installers,="" with="" specified="" installation="" request="" (dif="" code).
="" (setupdicallclassinstaller(dif_propertychange,="" hdevinfo,="" &spdevinfodata)="=FALSE)" }
="" }="" }
}<="" code="">
For this i am trying to create a GUID inside the second for loop where in i get "{CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC}" as 'ret' value instead of {A89377EA-D4ED-4A03-A303-A37F-4A9DE785E1A9} which is the '&GuidString[1]' value.
I think i need to typecast correctly.
Kindly help!
Priya Sundar
|
|
|
|
|
use
GUID *ret;
ret = new GUID;
instead of
GUID ret;
after that delete ret
-Sachin
|
|
|
|
|
hi sachin,
Thanks for replying.
But that didnt work. Now the 'ret' just gets created with the default value 'CDCDCDCD-CDCD-CDCD-CDCDCDCDCDCD}' and the funtion UuidFromString() produces no effect on it.
any other idea??
Priya Sundar
|
|
|
|
|
Priya_Sundar wrote: GUID ret;
UuidFromString(&GuidString[1], &ret);
GUID ret = { 0 };
UuidFromString(GuidString, &ret);
Nibu thomas
MVP For VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|
|
Hi,
That didnt work.
now 'ret' is created with default val "{00000000-0000-0000-0000-000000000000}" and the function UuidFromString() causes no effect..
Thankyou for your sugesstion!
Any more ideas??
Priya Sundar
|
|
|
|
|
Priya_Sundar wrote: UuidFromString
What does the return value from UuidFromString say. Refer MSDN for more information. Check given GUID string.
Nibu thomas
MVP For VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|