|
use a int variable to hold the counter ( file number )
use CString::Format to format the counter into a string.
use the for loop to increment the counter and format filename as a string, and pass it to the SavePMJStream .
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
macmac38 wrote:
Untill now i do the following:
// Save the file...
if (r)
{
CString fileName = "e:\\data\\001.pmj";
SavePMJStream(fileName);
}
----------------------------
CString csPath, csFileName;
int nLastFile;//Keep SomeWhere (Registry/file)
csPath = "e:\\Data\\";
if (r)
{
csFileName.Format("%03d", ++nLastFile);
csPath +=csFileName;
SavePMJStream(csPath);
}
Why Not THIS.?????
CodeTheDreams();
|
|
|
|
|
I use a CListCtrl on a dialog. The problem is that the background of the icons is somehow changed to black when the dialog pops up. But the background is supposed to be transparent.
Who knows how to prevent this?
This is the code that i use:
CMyDlg::OnInitDialog()<br />
{<br />
m_imageList.Create(32, 32, ILC_COLOR4, 2, 2);<br />
<br />
for(int i=0; i<2; i++)<br />
{<br />
int nID = GetIconID( i );<br />
<br />
HICON hIcon = ::LoadIcon(AfxFindResourceHandle(MAKEINTRESOURCE(nID),<br />
RT_GROUP_ICON), MAKEINTRESOURCE(nID));<br />
<br />
m_imageList.Add(hIcon);<br />
}<br />
<br />
m_listCtrl.SetImageList(&m_imageList, LVSIL_NORMAL);<br />
<br />
for(int nIndex=0; nIndex<2; nIndex++)<br />
{<br />
m_type.InsertItem(nIndex, "some text", nIndex);<br />
<br />
nIndex++;<br />
}<br />
}
Thanks in advance,
Jochem
|
|
|
|
|
not sure but it could be this
Jochem wrote:
m_imageList.Create(32, 32, ILC_COLOR4, 2, 2);
try using ILC_COLOR16|ILC_MASK instead of ILC_COLOR4
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Adding ILC_MASK did the trick
|
|
|
|
|
Hello,
I am creating a DLL, which I get a set of data, while within every data, there are several kinds of data type, something like:
Data1
int i=2;
String s="John";
Date d="1980/10/10";
Date3
int i=3;
String s="kevin";
Date d="2003/11/05";
Data3
...
...
I am trying to load these data in memory and offer method like GetData() to application programmer who is going to use my DLL.
Can someone give me little hint that which type should I use to store these day?
Is it correct that I use struct to store each "Data", and create a template to store all these "Data"s?
Thanks!
|
|
|
|
|
A structure lets you define a new data type that is a collection of other data types.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
One solution is a class if the design fits. Otherwise, use a structure as the other members has mentioned.
Kuphryn
|
|
|
|
|
Hi Kuphryn, thanks for your reply!
Then if I use structure, since I have many "structure" for many datas in the application, i.e. Data1, Data2, Data3,etc.. How could I access individual structure? Should I use template to store these structure?
|
|
|
|
|
Given that you store the same set of class or structure objects in a file, one solution is to use read() along with seekg(sizeof(object)).
Kuphryn
|
|
|
|
|
Hi,
I have a class template defined in a file called X.h:
template<class a="defaultA," class="" b="defaultB">
class X
{
...
bool test(string args);
};
And the functions defined in X.cpp :
template <class a,="" class="" b="">
bool X<a, b="">::test(string args)
{ ...
}
But the compiler (MSVC++6.0) claims "unresolved external symbol: bool X<defaulta, defaultb="">::test(string args)" during the linking stage. It works
fine if the function definition is in the X.h file but when separated the compiler can't seem to find the template and create the correct function. Note: it works if I change the definition in X.cpp to the specialized version, e.g.:
bool X<defaulta, defaultb="">::test(string args) { ... };
If anyone has any ideas it would be appreciated,
Cheers,
Julian Churchill
|
|
|
|
|
Templates are compile time and thus the function definitions MUST be known during compiler time. Place the function definitions in the H file.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hy all,
I have a problem and I don't know how manage it in the better way.
This is the calling of Open method using the OLE DB access to Database.
hr = TheCdboSPMigrationAccessor.Open(DBSession, sqlcmd_Migration.c_str());
My sqlcmd_Migration is variable of std::string type,unfortunatly this string is very long (more or less 600 characters!!) and I think to have limitation problem using string type.
I thought to use the vector of char but I need to use the functionality like CONCATENATION, parametrization of some parts of this string ect...
Can someone suggest me how resolve this problem or eventually a good compromise???
Thanks in advance!!!
Andrea
|
|
|
|
|
Is "sqlcmd_Migration.c_str()" your attempt to pass a buffer of 600 to the function? If yes then it is a problem. ".c_str()" provides access to the buffer, but there is no magic that makes it char[600].
|
|
|
|
|
What leads you to believe that there is something wrong with std::string? It can handle a string 5 or 5,000,000 characters long.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hy Tim,
thanks in advance for your support!!!
I think so because when I debug my application and look the sqlcmd_Migration value,I see that the string is not complete,and if I try to delete some blank space in my string... I see that the string itself change format!!!
Bye
Andrea
|
|
|
|
|
In early versions of the VC6 STL, there was a bug with deleting characters from the string. However, if you have kept your compiler up to date, I think that shouldn't be an issue anymore. Also, if you use STLPort, that won't be an issue.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
In debug mode, we just see variables having length not exceeding 255 or 300 characters.
=======================
Nothing is perfect
|
|
|
|
|
Hi,
I'd like to be giving constant feedback of the operation of my program to the user via the icon in the status area. This will require manipulating the actual pixels in the icon image. Is there any way to write to a bitmap and then load THAT as the icon, or.. what is the best way to go about doing this?
Thanks,
- Jason
(SonorkID 100.611)
The Code Project - Orange makes the art grow fonder
|
|
|
|
|
You can use the CreateIcon function in the API to dynamically create icons and then put the handle into notifyicondata... But if the 'feedback' is not going to be relatively frequent, I'd recommend using balloon tips over the systray icon instead. They're much nicer imho.
|
|
|
|
|
Hello,
I am trying to create a instance of my class in case structure with the following code:
void CAppliDlg::OnOK()
{
switch (choice){
case 1:
m_Result.SetWindowText("Choice 1 is made");
//Create instance of my class here, the error comes from here.
MyClass aMyclass;
break;
case 2:
m_Result.SetWindowText("Choice 2 is made");
break;
case 3:
m_Result.SetWindowText("Choice 3 is made");
break;
default:
break;
}
}
It gives me a error:"initialization of 'MyClass' is skipped by 'case' label", can someone kindly figure out what the problem could be?
Thanks!
|
|
|
|
|
|
Thanks;)
But my purpose is to create the instance only within that case condition...
With a bracket it works now.;)
|
|
|
|
|
put brackets around the contents of "case 1" :
switch(...)
{
case 1:
{
stuff
}
break;
case 2:
break;
}
-c
When history comes, it always takes you by surprise.
|
|
|
|
|
With brackets it works!
Thanks!
|
|
|
|