|
Well unfortunately Windows OS after 2000 or may be NT wouldn't allow you this, check out my post here
http://cyberlifeday.blogspot.com/2009/12/booting-windowslinux-os-any.html
in brief to do same, you'll need to change drive letter to A: or B:, read the post for reason and behind the scenes. 
|
|
|
|
|
Hi All,
Is there any way using which I can share my socket deccripter between multiple processes?
~ Vikram S
|
|
|
|
|
Apparently, yes [^](I never done it).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi experts,
I have a dll that uses MFC as shared dll and it has many dialogs in it & was working fine till the time the project was in VS 2002 but recently I have converted the VS 2002 project to VS 2008 project and now none of the dialog is showing up. So, could anyone please suggest whats going wrong.
Regards,
Pankaj Sachdeva
There is no future lies in any job but future lies in the person who holds the job
|
|
|
|
|
Can you debug an see what is causing the issue?
|
|
|
|
|
DoModal is just returning -1 which means that DoModal is unable to create the dialog.
Regards,
Pankaj Sachdeva
There is no future lies in any job but future lies in the person who holds the job
|
|
|
|
|
Karismatic wrote: DoModal is just returning -1 which means that DoModal is unable to create the dialog.
Use GetLastError[^] to check the error code, it may give you some hints, hopefully.
|
|
|
|
|
Hi all,
I want to transfer a Wave File using UDP. how this is possible. Please give me steps what to follow exaclty. so that the wave file must be transfer to destination machine.
thanks in advance,
uday
|
|
|
|
|
|
first of all why you going for some file transfer using UDP, if you, then you need to implement something that counts on packets recieved, that would be something like tcp implementation, so why not just go for tcp as transport protocol moreover many ISP aren't good with UDP data transfer, I mean their bandwidth controller goes on dropping lot of UDP packets....
it'll be good if you elaborate your problem...tell you one interesting thing FTP is indeed based on UDP with same as I said above.
|
|
|
|
|
Its not my Intrest. Client want to Implement in UDP. So i have to go through that.
|
|
|
|
|
I am maintaining the source code which uses CButtonST buttons as icon controls to display transparent and overlay icons (for the small arrow at the corner of the main icon) on the GUI. User can change the icon.
When user is changing the icon, what I do in the code is to invoke CButtonST::SetIcon with another HICON handle. But there is the residue of the old icon which is unwanted. The new icon overlaps on top of the old one.
How to remove the old residue icon? Please advise. Thanks.
According to the comment by the author of CButtonST, calling SetIcon(0, 0) can remove any old icons from it.
[ quote ] // Pass NULL to remove any icon from the button. [ / quote ]
But in fact this call makes the application crash!
[Update]
I found someone had added two lines in CButtonST::FreeResources to do DeleteDC() and DeleteObject() . This issue was caused by these two calls. The problem is fixed after removing them.
Maxwell Chen
modified on Wednesday, December 30, 2009 3:36 AM
|
|
|
|
|
Can you debug and see why SetIcon(0, 0) fails?
|
|
|
|
|
Rejeesh.T.S wrote: Can you debug and see why SetIcon(0, 0) fails?
There are 3 versions of SetIcon , one is SetIcon(int, int) and the second is SetIcon(HICON, HICON) .
I think the compiler links it to SetIcon(int, int) when I wrote SetIcon(NULL, NULL) . So I casted it to force it invoke the correct version by SetIcon((HICON)NULL /* second arg has default val */) . And it does not crash now.
But there is still old residue icon. I just downloaded the demo source of CButtonST v3.9 from CodeProject, and modified the code to make it change icon dynamically. I do not see it have this problem. And I compared the source code of CButtonST between the demo source and my code. They look the same regarding the icon drawing portion. This is so weird ...
Maxwell Chen
|
|
|
|
|
Hi,
In my applcaiton i have lot of views.But mainframe should be hided.So i created as single document each view as follow
pGroupViewTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CCentumVPDoc),
RUNTIME_CLASS(CFrameWnd),
RUNTIME_CLASS(CGroupView));
AddDocTemplate(pGroupViewTemplate);
pGraphViewTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CCentumVPDoc),
RUNTIME_CLASS(CFrameWnd),
RUNTIME_CLASS(CGraphView));
AddDocTemplate(pGraphViewTemplate);
I wil hide the mainframe window by
pMainFrame->ShowWindow(SW_HIDE/*m_nCmdShow*/);
But now i want toolbars for every view.I dont know where i put the code for getting toolbar.If it is MDI wnidow,then i will put that code in chilframe class.
Mainly to hide mainframe window,i avoid MDI.
What cna i do?
Anu
|
|
|
|
|
How to read the contents of a text file and insert in a map<string, string="">?
The text file format is
name1<tab>value1<space>value2
name2<tab>value1<space>value2
|
|
|
|
|
What map are you planning to use? An STL map?
Each map entry is a pair of key and value. So what would be the expected key and value pairs?
|
|
|
|
|
yes an STL map.
the key will be the name and the value will be the values.
text file format is
name1<tab>value1<space>value2
name2<tab>value1<space>value2
|
|
|
|
|
Homework?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Following is the simplest way to use a map.
#include <map>
using namespace std;
...
map<string, string> mp;
mp["name1"] = "Value";
mp["name2"] = "value2";
|
|
|
|
|
ratprita wrote: name1value1value2
name2value1value2
How can you tell among name and values (there are no separators in your file)?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
yes there are seperators.
name1 and value1 are seperated by tab.
value1 and value2 are seperated by space.
The first line(name1 tab value1 space value2)\n
second line(name2 tab value1 space value2)
|
|
|
|
|
You may use a map whoose key is a string containing the name and whose value is a vector of string (each of the latter containing one of 'value1', 'value2', etc...). For instance:
#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
map <string, vector <string > > item;
const int SIZE=0x100;
char buf[SIZE];
ifstream ifs("foo.txt");
while (ifs.getline(buf,SIZE).good())
{
size_t m, n;
string s(buf);
string name;
vector <string> value;
if ( (m=s.find('\t')) != string::npos)
{
name = s.substr(0,m);
while ((n=s.find(' ',m+1)) !=string::npos)
{
value.push_back( s.substr(m+1,(n-m)));
m=n;
}
value.push_back(s.substr(m+1));
item.insert(make_pair(name,value));
}
}
map <string, vector <string > >::iterator itm;
for ( itm = item.begin(); itm != item.end(); itm++)
{
cout << "name = " << itm->first << endl;
vector <string>::iterator itv;
for ( itv = itm->second.begin(); itv != itm->second.end(); itv++)
{
cout << '\t' << *itv << endl;
}
}
}
Please note: code should be made more robust (it isn't robust at all). That's left as exercise to the reader.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The name1 is "name1" , the value1 is "value1" .
Just kidding!
Maxwell Chen
|
|
|
|
|
I'm trying to write an exe to load my driver into the kernel, I'm getting an error ERROR_PATH_NOT_FOUND. I know my sys file is in the at this path, what am I missing?
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
bool LoadDriver();
int _tmain(int argc, _TCHAR* argv[])
{
bool status;
status = LoadDriver();
if (status)
printf("Driver load Succeeded!\n");
else
printf("Driver load Failed!\n");
return 0;
}
bool LoadDriver()
{
wchar_t PATH[1024] = L"C:\\DLOADER\\DLOADER\\Debug\\target.sys";
wchar_t DRIVERNAME[1024] = L"target.sys";
printf("PATH: %ls\n", PATH);
printf("DRIVERNAME: %ls\n", DRIVERNAME);
SC_HANDLE sh = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if(!sh)
return false;
SC_HANDLE rh = CreateService(sh,
DRIVERNAME,
DRIVERNAME,
SERVICE_ALL_ACCESS,
SERVICE_KERNEL_DRIVER,
SERVICE_DEMAND_START,
SERVICE_ERROR_NORMAL,
PATH,
NULL,
NULL,
NULL,
NULL,
NULL);
if(!rh)
{
printf("CreateService Failed(error%i)\n",GetLastError());
if (GetLastError() == ERROR_SERVICE_EXISTS)
{
rh = OpenService(sh,
DRIVERNAME,
SERVICE_ALL_ACCESS);
if(!rh)
{
printf("OpenService Failed(error%i)\n",GetLastError());
CloseServiceHandle(sh);
return false;
}
else
printf("OpenService Success\n");
}
else
{
CloseServiceHandle(sh);
return false;
}
}
if(rh)
{
if(0 == StartService(rh, 0, NULL))
{
printf("StartService Failed(error%i)\n",GetLastError());
if(ERROR_SERVICE_ALREADY_RUNNING == GetLastError())
{
}
else
{
CloseServiceHandle(sh);
CloseServiceHandle(rh);
return false;
}
}
else
printf("StartService Success\n");
CloseServiceHandle(sh);
CloseServiceHandle(rh);
}
return true;
}
Here is the output:
PATH: C:\DLOADER\DLOADER\Debug\target.sys
DRIVERNAME: target.sys
CreateService Failed(error1073)
OpenService Success
StartService Failed(error3)
Driver load Failed!
Any help would be appreciated!
Ohh and heres what those error codes are:
ERROR_SERVICE_EXISTS = 1073
ERROR_PATH_NOT_FOUND = 3
|
|
|
|