|
Hi CPians,
I would like to change programmatically the version information of a file (e.r. the ones you get when you open the properties dialog of a file in the explorer). This is for adding revision information automatically.
I know how to access this data (GetFileVersionInfo ,GetFileVersionInfoSize and similar) but how can I modify it ?
Thanks,
~RaGE();
|
|
|
|
|
Use RT_VERSION with this.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks for the answer David, but this is only for Word documents, isn't it ? I was actually hoping to change the properties of any file (Word document, text file, ...).
~RaGE();
|
|
|
|
|
Rage wrote:
...but this is only for Word documents, isn't it ?
No, it works for others too.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
//header file
/////////////////////////////////////////////
node* next;
};
class cqueuetype
{
public:
cqueuetype();
void EnqueueRear(node* newNode);
void display();
bool isempty();
void makeEmpty();
void save();
void load();
void find();
void find1();
char infile();
void num_of_memo();
private:
node* rear;
node* front;
int counter;
};
//////////////////////////////////////////////
//Part of da cpp
//////////////////////////////////////////////
void cqueuetype::save()
{
node* saving=front;
ofstream outfile("c:\\queue.txt",ios::out);
if(!outfile)
{
cout<<"Can not find drive"<<endl;
}
="" else
="" {
="" outfile<<counter<<endl;
=""
="" while="" (saving="" !="NULL)
" outfile<<"title:"<<endl;
="" outfile<<"="" "<<saving-="">Title<<endl;;
outfile<<"date="" &="" time:"<<endl;
="" outfile<<"="" "<<saving-="">Date_Time<<endl;
outfile<<"memo:"<<endl;
="" outfile<<"="" "<<saving-="">Content<<endl;
outfile<<"....................................."<<endl;
="" saving="saving-">next;
}
outfile.close ();
}
}
And here is an example of da file it saved
2
TITLE:
Bad Day
Date & Time:
06/19/2005 04:19:27 PM
MEMO:
Today is da worst day in my life..
.....................................
TITLE:
Good Day
Date & Time:
06/20/2005 04:19:27 PM
MEMO:
Today is a Good day.
.....................................
Now this (2) is the number of memos in my file
but now i got a problem which is...as soon as close my programe and run it again , and ask da program to display da memos , it cant display it well , cause it cant read it from da file...
da other problem is , if i added a new entry before i load da file , all da old enteries will be deleted... it will over write on it...
So... i need to know what shall i do , and what is da prober load function i can use , where i have 3 string , in dat node i load....
My regards ,
Bahy
|
|
|
|
|
ana_bahy wrote:
and ask da program to display da memos , it cant display it well , cause it cant read it from da file...
That's normal because when you open the file, its contents are destroyed. Try to use that instead:
ofstream outfile("c:\\queue.txt",ios::out | ios::app);<br />
ana_bahy wrote:
da other problem is , if i added a new entry before i load da file , all da old enteries will be deleted... it will over write on it...
We cannot guess what's happening during the load if you don't post the code.
And please, use the formating tags to make your code look better (it is just above the emoticons, use the 'code' or 'pre' tag).
|
|
|
|
|
Thank you soo much for ur fast reply , i really appriciate that
Here is my load code
//////////////////////////////////////////////////////////
char cqueuetype::infile()<br />
{<br />
char Title[30];<br />
char Content[100];<br />
char Date_Time[36];<br />
<br />
ifstream infile("c:\\queue.txt",ios::in);<br />
cout<<"\n\n\n\t Data are be saved now\n\n\n"<<endl;<br />
infile >> counter;<br />
for (int b=0;b<counter;b++) <br />
{ <br />
<br />
infile.ignore(7);<br />
infile.get(Title,30,'#');<br />
infile.ignore(13);<br />
infile.get(Date_Time,36,'#');<br />
infile.ignore(6);<br />
infile.get(Content,100,'#');<br />
node* temp;<br />
temp=new node;<br />
<br />
temp->Title=Title;<br />
temp->Date_Time=Date_Time;<br />
temp->Content=Content;<br />
temp->next= NULL; <br />
if (front==NULL)<br />
{<br />
rear=temp;<br />
front=temp;<br />
temp->next=NULL;<br />
}<br />
else<br />
{<br />
temp->next=front;<br />
front->next=temp;<br />
front=temp; <br />
}<br />
} <br />
infile.close();<br />
return 0;<br />
<br />
}
/////////////////////////////////////////////////////////////
My regards,
Bahy
|
|
|
|
|
Remarks:
for (int b=0;b<counter;b++)
|
|
|
|
|
for (int b=0;b<counter;b++)
|
|
|
|
|
Ok ok ok !! Stop it Don't overflow the forum by trying to format it
for (int b=0;b<counter;b++)
|
|
|
|
|
The only way to print a < symbol is to use the tag next to the 'code' tag. But ok, I understood what it was... And when you say that it cannot load the data, what is exactly the problem ? (Try to be as much precise as possible).
|
|
|
|
|
Do u have A personal email , to send u da file?
|
|
|
|
|
Other peope here are also able to help you. I don't know if I can solve your problem so it is better to post everything on the forum. And I don't need your source files because I don't have the time to run a project for that.
Better try to understand your problem and then give here a good description of what is happening. Also, a tool that could help you a lot is the debugger (press F9 to set a breakpoint somewhere in your code and press F5 to start the debugger). You will be able to watch the different variables and see what's happening.
|
|
|
|
|
Its ok... Thanks anywayz for your help... :->
My regards,
Bahy
|
|
|
|
|
Hello,
ana_bahy wrote:
but now i got a problem which is...as soon as close my programe and run it again , and ask da program to display da memos , it cant display it well , cause it cant read it from da file...
does <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/html/vclrf_istream_basicistreamgetline.asp" rel="nofollow">ifstream</a>[<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/html/vclrf_istream_basicistreamgetline.asp" target="_blank" rel="nofollow" title="New Window">^</a>] help?
Example:
std::ifstream infile("c:\\queue.txt",ios::in);
char Buf[256];
::SecureZeroMemory(&Buf[0], 256);
infile.getline(&Buf[0], 255, '\n');
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I'm currently using SetDlgItemText to change the text in the edit boxes, and each of the edit boxes has OnChangeEdit function that runs as soon as its contents are changed. Now in a few rare cases, I need to change the contents of the edit box without starting the OnChangeEdit function. Is there a way to temporarily disable that function or modify the contents of the box without OnChangeEdit noticing? I just wanted to know if there is an easy way to deal with this before I start writing code that complicates my program.
|
|
|
|
|
I think the easiest way for doing that is use a member variable of the class. Use a boolean for example. And, at the begining of your OnChangeEdit function, check if this boolean is true or false. If it is false, return, otherwise continue.
I don't think this will complicate your program a lot
|
|
|
|
|
You obviously type faster than I do... (See my post below...)
|
|
|
|
|
Yes, it seems ... But I think it is a rather common solution also
|
|
|
|
|
I have not ever been aware of such a command, not since Windows 3.1 anyways.
I usually set a boolean that I test in the OnChangeEdit. If the boolean is true, then just return from the OnChangeEdit. Set it before changing your text, clear it after done changing the text.
|
|
|
|
|
I want to translate ,scale and rotate a polygon
using win32 GDI or API's
you can also use the XForm matix to achive this
i'am unable to do it properly ,could some one help on this
thanks in advance
pradish
thanks in advance
pradish
|
|
|
|
|
I never used XForm so I have no idea what function you'd call to apply the transform. I suggest you look up 2D transformations.
For example here is an examlpe of what you're talking about.
To summarize:
Translations are easy, all you do is take each point in your polygon and add an offset to it to shift each point.
Scaling you perform by multiplying each point by some number. However if you just do scaling on each point of the polygon you're scaling about the screen origin so your polygon will move. To do scaling on the polygon only you'd need to translated it to center the polygon at (0,0) coordinates and then apply scaling, then apply the inverse transform to move it back to where it was.
Rotation is similar. You're multiplying each point by some sines and cosines, but you have to consider about which point you're rotating your polygon.
|
|
|
|
|
Thank you Budric,it was very informative
and Thanks for the link that is just funtastic
|
|
|
|
|
Has anyone tried Jeffrey Richter's IAT patching technique on IE to intercept wininet calls? I cant seem to get it working, so would like to know other's experiences to decide if digging deeper is worth trying.
Basically, none of the modules in IE seem to have WININET functions like InternetConnectW or HttpSendRequestW in their import tables, but windbg does show IE calls them.
Thanks in advance
|
|
|
|
|
Hi,
//Formatting of the code supplied
I am writing an application which supports loading, processing, and displaying of various image file formats.
I have a class, CDib, derived from CBitmap that displays the bitmap data on the device context supplied using BitBlt(...). I think this is a fairly general way dc voodoo.
//!Code Snippet (1)
//!CDib is derived from CBitmap
//!@param dc: reference to CDC where the image is to be drawn
//!@param pbm: CBitmap pointer that contains the image data, in most cases a pointer to itself
<code>
BOOL CDib::Draw(CDC& dc, CBitmap* pbm, const CRect* rcDst, const CRect* rcSrc)
{
CRect rc;
if (!rcSrc) {
// if no source rect, use whole bitmap
rc = CRect(CPoint(0,0), GetBitmapSize(pbm));
rcSrc=&rc;
}
if (!rcDst)
// if no destination rect, use source
rcDst=rcSrc;
bool bRet;
//Create a memory DC and load the bitmap onto it
CDC memDC;
memDC.CreateCompatibleDC(&dc);
CBitmap* pOld = (CBitmap*)(memDC.SelectObject(pbm));
if(rcSrc->Size() == rcDst->Size()){
bRet = dc.BitBlt(rcDst->left, rcDst->top,
rcDst->Width(), rcDst->Height(),
&memDC, rcSrc->left, rcSrc->top, SRCCOPY);
} else{
dc.SetStretchBltMode(COLORONCOLOR);
bRet = dc.StretchBlt(rcDst->left, rcDst->top,
rcDst->Width(), rcDst->Height(),
&memDC, rcSrc->left, rcSrc->top, rcSrc->Width(), rcSrc->Height(),
SRCCOPY);
}
//!Delete the memory DC
memDC.DeleteDC();
return bRet;
}</code>
This function works fine if I load a BMP file using CBitmap::LoadImage(...).
Now,since the program can load other image file formats, I tried using CBitmap::CreateBitmap(...) but that didn't work. So, what I have done now is to use CreateCompatibleBitmap(...) and CreateCompatibleDC(...) to create a CDC and CBitmap object, and then linked them together using SelectObject(..), and then use SetPixel(...), now the problem is that SetPixel(...) is very very slow. I want to ask the readers if there is an alternate way to SetPixel where I can load a chunk of image data to the CBitmap object, and then pass it to CDib::Draw(..) function.
<code>//!Code snippet 2
//!@param pData: image data that needs to be displayed
void CImageDraw::CreateBitmap(BYTE* pData)
{
//!Create a DC
CDC dc;
dc.CreateCompatibleDC(NULL);
//!If m_dib exists delete it
if((HBITMAP)m_dib)
m_dib.DeleteObject();
m_dib.CreateCompatibleBitmap(AfxGetMainWnd()->GetDC(), m_nImgWidth, m_nImgHeight);
CBitmap *pOldBitmap = (CBitmap *)dc.SelectObject(&m_dib);
for(int y = 0; y < m_nImgHeight; y++){
for(int x = 0; x < m_nImgWidth; x++){
//!This is very very slow.....I need an alternative
dc.SetPixel(x,m_nImgHeight-1-y, RGB(pData[3*x+2+y*m_nImgWidth*3], pData[3*x+1+y*m_nImgWidth*3], pData[3*x+y*m_nImgWidth*3]));
}
}
dc.SelectObject(pOldBitmap);
dc.DeleteDC();
}
</code>
Thanking in anticipation
Swati<code></code>
|
|
|
|
|