|
After I uninstalled VC2005, I lost the file associations with VC6.
I've found a reg file on Internet, but it's not complete, so I ask for a hand here. Thanks.
Here is the reg file:
<br />
Windows Registry Editor Version 5.00<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile]<br />
@="C Source file"<br />
"AlwaysShowExt"=""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\DefaultIcon]<br />
@="C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe,-20210"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell]<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev]<br />
@="&Open with MSDEV"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev\command]<br />
@="\"C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe\" \"%1\""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev\ddeexec]<br />
@="Open(\"%1\")"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev\ddeexec\application]<br />
@="msdev"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev\ddeexec\topic]<br />
@="system"<br />
<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile]<br />
@="C++ Source file"<br />
"AlwaysShowExt"=""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\DefaultIcon]<br />
@="C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe,-20209"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell]<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev]<br />
@="&Open with MSDEV"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev\command]<br />
@="\"C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe\" \"%1\""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev\ddeexec]<br />
@="Open(\"%1\")"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev\ddeexec\application]<br />
@="msdev"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev\ddeexec\topic]<br />
@="system"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile]<br />
@="Resource Template"<br />
"AlwaysShowExt"=""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\DefaultIcon]<br />
@="C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe,-20212"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell]<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev]<br />
@="&Open with MSDEV"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev\command]<br />
@="\"C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe\" \"%1\""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev\ddeexec]<br />
@="Open(\"%1\")"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev\ddeexec\application]<br />
@="msdev"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev\ddeexec\topic]<br />
@="system"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile]<br />
@="C Header file"<br />
"AlwaysShowExt"=""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\DefaultIcon]<br />
@="C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe,-20211"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell]<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev]<br />
@="&Open with MSDEV"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev\command]<br />
@="\"C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe\" \"%1\""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev\ddeexec]<br />
@="Open(\"%1\")"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev\ddeexec\application]<br />
@="msdev"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev\ddeexec\topic]<br />
@="system"<br />
The candidates are .dsw .dsp .pcb .clw .opt .ncb .dsm.
|
|
|
|
|
Why not uninstalling and installing it again? surely they have a "repair" option there...
|
|
|
|
|
I have tried both methods, they didn't take effect.
|
|
|
|
|
Is there a way to determine the address of an executable's entry point using the ImageHlp library?
|
|
|
|
|
Maybe MapAndLoad() - In the LOADED_IMAGE struct, see
FileHeader.OptionalHeader.AddressOfEntryPoint
For a code sample showing how to parse an EXE yourself, see this article:
HOWTO: How To Determine Whether an Application is Console or GUI[^]
and look for IMAGE_OPTIONAL_HEADER.AddressOfEntryPoint.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks, that does the trick!
|
|
|
|
|
|
Armond Sarkisian wrote: Anyone out there know what the code is for C++ to check services and stop/start/restart them as needed?
That's a job for the Service Control Manager[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
I'm using the code from msdn to add ACE for a folder :
http://support.microsoft.com/?scid=kb%3Ben-us%3B102102&x=9&y=10
But i've got a problem : The user I add with "GENERIC_ALL" is added but only with the special right , no with read/write/modify right. I've try this code under vista and windows 2003, and got the same result.
Can someone help me ? Thanks
PS : That work with file but not directory...
-- modified at 17:05 Saturday 13th October, 2007
|
|
|
|
|
Windows has a MapGenericMask API, but that's more for implementing your own access control, you may not know what the right GENERIC_MASK structure is. The masks should be FILE_GENERIC_READ, FILE_GENERIC_WRITE, FILE_GENERIC_EXECUTE and FILE_ALL_ACCESS, but I don't think there's an actual requirement for this.
The SetEntriesInAcl API (added in Windows 2000) is a lot friendlier than that sample code! It might already do what you need.
I don't think there's any problem setting the generic bits in an ACE. It's more likely that you've not set the inheritance bits correctly. I don't have the space nor understand it well enough to give a good treatment of it here - read Keith Brown's "Programming Windows Security".
SetNamedSecurityInfo does propogate the settings down the tree, applying the correct inheritance, so that shouldn't be the problem, unless the files have been created with protected DACLs (by using SE_DACL_PROTECTED or unchecking the 'Allow inheritable permissions from parent to propogate...' checkbox on the Security tab of the file's Properties page).
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Im doing a simple file programming in C++(im using turbo C version 3.0 editor)
Iam using the Fstream class..
I can create & write datas into file successfully .. .
But after some set of operations when I list the contents of the file. I get some ascii characters (like @ etc) or some irrelevant numbers. . .
Can any one plz tell me what is happening. . .
The same piece of code gives the correct output when I try it using VS 6.0 . . Plz help me. . ( VS6.0 is not recognizing clrscr() & gotoxy() – I had used conio.h)
I want the program to work correctly from my Turbo C compiler .. .(its being used in my College)
Thanks in Advance . .
Proud To Be an Indian
|
|
|
|
|
vivekphlp wrote: I want the program to work correctly from my Turbo C compiler .. .(its being used in my College)
Wow....Turbo C 3.0 came out 16 years ago...
Still, I would expect it to work (I guess). Depends on the runtime library.
Without seeing any code it's impossible to guess what's wrong.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
vivekphlp wrote: VS6.0 is not recognizing clrscr() & gotoxy()
Ah, I miss those two functions. I built some pretty snazzy apps for the convenience store industry in the 90's and those two made 80x25 character grid programming a snap.
I somewhat recall that when I moved from Turbo C++ 3.0 to Visual C++ 6.0, I looked for those functions to see if I could port my apps to Windows console based apps but it ended in failure.
Concerning your issue, as someone mentioned earlier, it would help to see the code snippets that are relevant to identify issues. Is it possible to post some source code snippets?
|
|
|
|
|
I Use the following code 2 write to file ->
b=l.newbook();
if(fiobook.eof()) fiobook.clear();
fiobook.seekp(0,ios::end);
fiobook.write((char*)&b,sizeof(b));
gotoxy (10,24);
cout<<"Do you want to continue Y/N?";
cin>>cx;
cin.get();
*************************
where .. . .newbook is
book library::newbook()
{
clrscr();
book b;
gotoxy(10,10);
cout<<"Acc No";
cin>>b.accno;
cin.get();
gotoxy(10,12);
cout<<"Title";
cin.getline(b.title,30);
gotoxy(10,14);
cout<<"Author";
cin.getline(b.author,30);
gotoxy(10,16);
cout<<"price";
cin>>b.price;
gotoxy(10,18);
cout<<"No of Copies";
cin>>b.nCopies;
b.issued=0;
b.memno=0;
return b;
}
EVERYTHING WORKS FINE ...
********************************************
Then I use a function to display the contents . ..
void library::list(fstream & fiobook)
{
clrscr();
book b;
fiobook.clear();
fiobook.seekg(0);
for(;;)
{
fiobook.read((char*)&b,sizeof(struct book));
if(fiobook.eof()) break;
cout<<"Acc no "<<b.accno<<endl
<<"title="" "<<b.title<<endl
="" <<"author="" "<<b.author<<endl
="" <<"price="" "<<b.price<<endl
="" <<"copies="" issued="" "<<b.issued<<endl
="" <<"total="" stock="" "<<b.ncopies<<endl;
="" *="" if="" (b.issued!="b.nCopies)
" cout<<b.ncopies="" -="" b.issued<<"="" copies="" available";="" memno;
="" else
="" cout<<b.ncopies<<"copies="" ;=""
="" cout<<endl<<endl;
="" getch();
="" }
="" }
after="" closing="" &="" reopening="" the="" appln="" i="" try="" to="" list="" out="" details="" data="" from="" this="" file="" unexpected="" chars="" some="" numbers="" etc="" will="" come.="" .
=""
<div="" class="ForumSig">Proud To Be an Indian
|
|
|
|
|
I took another look around for the gotoxy stuff and to my embarrassment, there is a reference to this in Mr. Dunn's FAQ right here on CP.
clrscr[^]
gotoxy[^]
|
|
|
|
|
I put some snippets together this morning over coffee using Mr. Dunn's information and came up with these. See if these might help you to use gotoxy and clrscr in Visual C++.
#include "stdafx.h"
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
bool gotoxy(int x, int y)
{
// Sets the cursor position
COORD coord={x,y};
HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
if (hConsole!=INVALID_HANDLE_VALUE) {
if (SetConsoleCursorPosition(hConsole,coord)) {
return true;
}
}
return false;
}
bool ClrScr()
{
// Use a system call to clear the screen
if (system("cls")!= -1) {
return true;
}
return false;
}
bool clrscr()
{
// Use a custom function to clear the screen
COORD origin={0};
CONSOLE_SCREEN_BUFFER_INFO conInfo={0};
HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
if (hConsole!=INVALID_HANDLE_VALUE) {
if (GetConsoleScreenBufferInfo(hConsole,&conInfo)) {
int nLength=conInfo.dwSize.X*conInfo.dwSize.Y;
DWORD dwNum(0);
if (FillConsoleOutputAttribute(hConsole,
conInfo.wAttributes,
nLength,origin,&dwNum)) {
dwNum=0;
if (FillConsoleOutputCharacter(hConsole,
(TCHAR)'\0',nLength,origin,&dwNum)) {
if (gotoxy(origin.X,origin.Y)) {
return true;
}
}
}
}
}
return false;
}
int main(int argc, char* argv[])
{
printf("Hello World\n");
// ClrScr();
clrscr();
gotoxy(5,5);
printf("Hello again\n");
return 0;
}
|
|
|
|
|
In regards to the strange characters your getting...
What is book? Do you have the code snippet showing it's declaration?
|
|
|
|
|
"Book is a structure"
struct book
{
int accno;
char title[30];
char author[30];
float price;
int issued;
int nCopies;
int memno;
};
IM Using this structure in My CLASS
class library
{
book book1;
member member1;
public:
book newbook();
void list(fstream &);
void issuebook(fstream &, fstream &);
void returnbook(fstream &, fstream &);
member newmember();
void listofmembers(fstream &);
} ;
Proud To Be an Indian
|
|
|
|
|
Hi,
I have an old ANSI VC++ dialog based application which I would like to make it UNICODE enabled application. So I started converting all "char" types to "TCHAR" types. Howerever there is a certain piece of code that is sort of hardwired with statements like
const char cEscape = -16;
If I convert it to TCHAR equivalent and compile and execute
const TCHAR cEscape = (const TCHAR)-16;
the value of the cEscape variable (as seen in quickwatch window in VC++ debugger) is 65520
I am wondering should the value of the cEscape variable be 240 which is unsinged char equivalent of signed char -16 or the value 65520 is correct?
Can someone please clarify?
Thanks and Regards
|
|
|
|
|
How about
const TCHAR cEscape = _T('\xF0');
That keeps the value -16 (240 unsigned) and it's generic/portable.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks though I think my question is still unanswered.
If the value of cEscape should be 240 (_T('\xF0') then could there be a reason that the VC++ 2005 compiler is evaluting it to 65520 and not 240 !
I have checked the disassembly and it shows that the compiler is assigning 0xFFF0 to the cEscape variable and not 0x00F0.
Regards.
|
|
|
|
|
psychedelic_fur wrote: could there be a reason that the VC++ 2005 compiler is evaluting it to 65520 and not 240
Yes.
I tested this (note I'm using VC++ 2005 SP2 compiler):
const TCHAR cEscape = _T('\xF0');
TCHAR s[10];
s[0] = cEscape;
My compiler settings have "Treat wchar_t as Built-in Type" set to "Yes".
cEscape is 240 as expected.
If that setting isn't enabled, then the result may be different.
If wchar_t is treated as a signed short int then the the entire value gets
treated as negative. Not good.
I suppose you can try this (preferred):
const TCHAR cEscape = _T('\x00F0');
or mask off the high byte (lame but works)
const TCHAR cEscape = _T('\xF0') & 0x00FF;
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The C++ standard does not dictate whether char is signed or unsigned. The default for char in Visual C++ is signed (but this can be changed with a compiler option). wchar_t is a typedef for unsigned short in older compilers and so is always unsigned.
This sounds like a value that is not used as a character, only as an 8-bit integer, and you should leave it as char rather than blindly converting to TCHAR . You should evaluate all uses of char carefully as it sounds like a codebase where a BYTE typedef was not used.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
I have to parse RSS channel definition XML file. I have appended one sample at the end of this topic.
I have installed MSXML parser 6 and uses it successfully. Please refer to function XmlRSSRead.
There are a lot of information about the channel and item of this channel. For example, one channel has title, link, description information. One channel may have a lot of item too. Each item also hase title, link, description information.
I have to extract title, link, description information in my application. I can not find one quick start guide from microsoft doucments.
Could anyone be kind to tell me what I should do next?
The following is the function I have now and the xml file I want to parse.
void XmlRSSRead( void )
{
//¡ä¡ä?¡§DOMDocument???¨®
MSXML2::IXMLDOMDocumentPtr pDoc;
HRESULT hr = pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument30));
if(!SUCCEEDED(hr))
{
AfxMessageBox( _T("?T¡¤¡§¡ä¡ä?¡§DOMDocument???¨®¡ê????¨¬2¨¦¨º?¡¤?¡ã2¡Á¡ã¨¢?MS XML Parser ??DD?a!") );
}
//?¨®?????t
pDoc->load( _T("D:\\temp\\mPhone\\Docs\\RSS\\nature.xml") );
//?¨²¨º¡Â?D2¨¦?¨°???achannel¦Ì??¨²¦Ì?,
// "//"¡À¨ª¨º??¨²¨¨?¨°a¨°?2?2¨¦?¨°
MSXML2::IXMLDOMElementPtr childNode ;
childNode = (MSXML2::IXMLDOMElementPtr)(pDoc->selectSingleNode("//channel"));
//¦Ì?¦Ì??¨²¦Ì?¨¤¨¤D¨ª
MSXML2::DOMNodeType nodeType;
childNode->get_nodeType(&nodeType);
//?¨²¦Ì???3?
BSTR var;
CString name;
childNode->get_nodeName(&var);
name = (char*)(_bstr_t)var;
//?¨²¦Ì??¦Ì
VARIANT varVal;
childNode->get_nodeTypedValue(&varVal);
CString strValue = (char*)(_bstr_t)varVal;
//?¨²¦Ì?¨º?D?,¡¤??¨²¨¢¡ä¡À¨ª?D
MSXML2::IXMLDOMNamedNodeMapPtr pAttrs = NULL;
MSXML2::IXMLDOMNodePtr pAttrItem;
childNode->get_attributes(&pAttrs);
long nCount ;
pAttrs->get_length(&nCount);
for(int i = 0 ; i < nCount ; i++)
{
pAttrs->get_item(i,&pAttrItem);
//?¨°???¨¦¨°?¨ª¡§1yo¡¥¨ºyget_nodeName,get_nodeTypedValue¦Ì?¦Ì?¨º?D???o¨ª¨º?D??¦Ì
//¨°2?¨¦¨°??¡À?¨®¦Ì?¦Ì?
CString strAttrName = (char*)(_bstr_t)pAttrItem->nodeName;
CString strAttrValue = (char*)(_bstr_t)pAttrItem->nodeTypedValue;
}
}
void mfXmlReadTest( void )
{
::CoInitialize(NULL);
MSXML2::IXMLDOMDocumentPtr spPtr;
HRESULT hr = spPtr.CreateInstance(__uuidof(MSXML2::DOMDocument30));
ASSERT(SUCCEEDED(hr));
spPtr->loadXML("<r>\n<t>top\nbottom\n");
spPtr->save("C:\\nature.xml");
spPtr.Release();
::CoUninitialize();
}
XMLÎļþÈçÏ£º
<rss xmlns:itunes="http://www.itunes.com/DTDs/Podcast-1.0.dtd" version="2.0">
<channel>
<title>Nature Podcast
http://www.nature.com/nature/podcast/rss/nature.xml <description>Nature is a weekly international journal publishing the finest peer-reviewed research in all fields of science. The Nature Podcast is a free weekly audio show highlighting content from each issue, and interviews with the scientists creating the data. The Nature Podcast provides insight and context to groundbreaking research, and allows the scientists to explain the significance of their work in their own words.
<language>en
<copyright>© 2006 Nature Publishing Group
<lastbuilddate>Wed, 25 Jul 2007 18:00:00 GMT
<category>Science & Medicine
<category>Technology
<url>http://www.nature.com/nature/podcast/images/nature_rss_logo.png
<title>Nature
http://www.nature.com/nature/podcast/rss/nature.xml <width>144
<height>144
<itunes:author>Nature
<itunes:subtitle>Interviews, insight and highlights of the latest scientific discoveries, every week in Nature
<itunes:summary>Nature is a weekly international journal publishing the finest peer-reviewed research in all fields of science. The Nature Podcast is a free weekly audio show highlighting content from each issue, and interviews with the scientists creating the data. The Nature Podcast provides insight and context to groundbreaking research, and allows the scientists to explain the significance of their work in their own words.
<itunes:owner>
<itunes:name>Nature
<itunes:email>podcast@nature.com
<itunes:category text="Science & Medicine">
<itunes:category text="Technology">
<itunes:image href="http://www.nature.com/nature/podcast/images/nature_itunes_logo.png">
<item>
<title>Nature Podcast: 26 July 2007
http://www.nature.com/nature/podcast/v448/n7152/nature-2007-07-26.mp3 <description>?26 July: Rain changes of our own making, science in the Simpsons, Californian-style plate rifts, investigating inflammatory bowel disease, pygmies with palm pilots.
<guid>http://www.nature.com/nature/podcast/v448/n7152/nature-2007-07-26.mp3
<enclosure url="http://www.nature.com/nature/podcast/v448/n7152/nature-2007-07-26.mp3" length="13343922" type="audio/mpeg">
<pubdate>Wed, 25 Jul 2007 18:00:00 GMT
<category>Science & Medicine
<category>Technology
<itunes:author>Nature
<itunes:subtitle>?26 July: Rain changes of our own making, science in the Simpsons, Californian-style plate rifts, investigating inflammatory bowel disease, pygmies with palm pilots.
<itunes:duration>37:03
<itunes:explicit>no
<itunes:category text="Science & Medicine">
<itunes:category text="Technology">
<itunes:keywords>nature, podcast, science, technology, education, science news, biology, physics, genetics, astronomy, astrophysics, quantum physics, evolution, evolutionary biology, geophysics, climate change, earth science, materials science, science policy, medicine, systems biology, genomics, palaeobiology, ecology, molecular biology, cancer, immunology, pharmacology, developmental biology, biochemistry, bioinformatics, nanotechnology, biotechnology, drug discovery, environmental science, life, marine biology, medical research, neuroscience, rna, dna, cell cycle, signal transduction, cell signalling
|
|
|
|
|
I would generally use selectNodes or selectSingleNode with an XPath expression to find particular information in an XML document.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|