|
Hi,
How can I copy text on clipboard?
|
|
|
|
|
Are you using MFC? If affirmative see the SetClipboardData[^] API
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
_AnsHUMAN_ wrote: Are you using MFC? If affirmative see the SetClipboardData[^] API
With SetClipboardData() , it matters not if MFC is being used.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
|
I need to know , for CListCtrlEx::OnNMCustomdraw(...) if list control have LVS_EX_FULLROWSELECT AND LVS_EX_GRIDLINES extended style ... my question is , there is a method to find that in single line of code ? I try this :
GetExtendedStyle() & LVS_EX_FULLROWSELECT & LVS_EX_GRIDLINES
but is stupid .
And one more thing : it's a good ideea to check that ( have 2 extended style ) in OnNMCustomdraw(...) in above style ? Or it be good thing to set up a variable that know if list control have both extended style ?
Thnak you .
|
|
|
|
|
You can check this as follows - if ((GetExtendedStyle() & LVS_EX_FULLROWSELECT) && (GetExtendedStyle() & LVS_EX_GRIDLINES))
If you want to assign it to a variable, you could do this -
bool bHasBothStyles = ((GetExtendedStyle() & LVS_EX_FULLROWSELECT) && (GetExtendedStyle() & LVS_EX_GRIDLINES));
bool bHasOneStyle = ((GetExtendedStyle() & LVS_EX_FULLROWSELECT) || (GetExtendedStyle() & LVS_EX_GRIDLINES));
|
|
|
|
|
Thank you for answer , I will do in this way . I try do to a fast code for NMCustomDraw(...).
|
|
|
|
|
Even though it works in one line, you should assign the return value of GetExtendedStyle() to a variable and then use the variable instead of calling GetExtendedStyle twice.
|
|
|
|
|
You are right . Thank you .
|
|
|
|
|
If checking for multiple flags, it might be easier to do it like this:
DWORD styles = (LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
bool bHasAllStyles = (GetExtendedStyle() & styles) == styles;
|
|
|
|
|
Don't forget that it is possible to set the CListCtrl style after it has been created. So to be safe, you should check the style right before you need to use it, rather than store it in a variable only once.
|
|
|
|
|
Hi all,
I am trying to find out how to check the 'check' state of a node in a TreeView control using C# in an ASP.NET application. Basically, I have a TreeView control that shows checkboxes. The user makes a selection which I want to store in a session variable upon a 'submit' button click. I use a 'TreeView.Node.Checked' statement to verify whether the user selected that node. This, however, does not work because the selection is made at the client side and when it gets posted to the server, the 'TreeView.Node.Checked' statement, whether selected or not, will always return 'false' for any node. Does anyone have a solution for this? Thx,
Ralf
ralf.riedel@usm.edu
|
|
|
|
|
|
Will do. Thx,
Ralf
ralf.riedel@usm.edu
|
|
|
|
|
Is it possible for a void function that outputs characters using the cout<< extraction statement be able to put its results into a specific file via an ofstream variable, and if yes then what function should I use?
The function works this way:
void encode(QueueNode *ithNode, char charKey)
{
if (ithNode->rightCursor != NULL)
{ if (ithNode->leftCursor->value == charKey)
cout<<"1";
else
{
cout<<"0";
encode(ithNode->rightCursor,charKey);
}
}
else
cout<<"1";
}
Basically, it outputs a binary string representation of a character. What I want to do now is to transfer each of these output bits into a file with a use of an ofstream function. Any ideas on how to do this?
|
|
|
|
|
You could rewrite the function to take the ostream as an argument
void encode(QueueNode *ithNode, char charKey, ostream &os)
{
if (ithNode->rightCursor != NULL)
{ if (ithNode->leftCursor->value == charKey)
os<<"1";
else
{
os<<"0";
encode(ithNode->rightCursor,charKey, os);
}
}
else
os<<"1";
}
And call it
ofstream ofs("data.dat");
encode(..., ..., ofs);
encode(..., ..., cout);
|
|
|
|
|
Got it, thanks for the advice.
|
|
|
|
|
hi
can i make the folder which of default to any file type ...
i had idea that if possible to convert the directory to a file format which have the unique extension so that when double clicked it will ask the password ...
actually i am doing the project on the folder security
|
|
|
|
|
If you are just wanting to set security permissions on a folder, see here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
That's pretty much how the tar format works, or any other bundling format, like zip and rar , for that matter. There's a lot of information on this if you search for it.
|
|
|
|
|
|
hi there i am working on a project and i am trying to implementing a multi linked list which nodes include more than one data and they are ordered diffrently by these keys(name,surname etc). i implemented the list and checked. so everything goes very well but after i realize that maybe i am not creating a multi linked list i know there must be more than one header node for a multi linked list and i added the nodes by name and first name correctly. so the only issue i am curious about. am i creating the multi linked list correctly or am i creating 2 different linked list.
this is the code which i pass the node as parameter to add functions;
while ( !feof(myfile) ) {
NODE* pnew_stu;
if( !(pnew_stu = (NODE*) malloc(sizeof(NODE))) ) {
printf("ERROR NOT ENOUGH MEMORY!!!\n");
exit(100);
}
fscanf(myfile,"%s", &(pnew_stu->first_name) );
fscanf(myfile,"%s", &(pnew_stu->last_name) );
fscanf(myfile,"%s", &(pnew_stu->email_addr) );
fscanf(myfile,"%d", &(pnew_stu->phone_num) );
fscanf(myfile,"%s", &(pnew_stu->address) );
fscanf(myfile,"%s", &(pnew_stu->city) );
fscanf(myfile,"%d", &(pnew_stu->zipcode) );
add_fn_Node(list,pnew_stu);
add_ln_Node(list,pnew_stu);
}
and this is the functions i added the node by name and first name;
void add_fn_Node(LIST* list, NODE* pnew_stu) {
NODE* temp = list->fn_head;
if( !(temp = (NODE*) malloc(sizeof(NODE))) ) {
printf("ERROR NOT ENOUGH MEMORY!!!\n");
exit(100);
}
if( list->fn_head == NULL ) {
pnew_stu->fn_next = list->fn_head;
pnew_stu->fn_pre = list->fn_head;
list->fn_head = pnew_stu;
list->fn_count = 1;
return;
}
else {
temp = list->fn_head;
if ( (strcmp( pnew_stu->first_name, temp->first_name )) <= 0 ) {
pnew_stu->fn_next = temp;
pnew_stu->fn_pre = temp->fn_pre;
temp->fn_pre = pnew_stu;
list->fn_head = pnew_stu;
list->fn_count++;
return;
}
else {
while ( temp->fn_next != NULL ) {
if ( (strcmp( pnew_stu->first_name, temp->first_name ) <= 0 ) && (strcmp( pnew_stu->first_name, temp->fn_pre->first_name) > 0)) {
pnew_stu->fn_next = temp;
pnew_stu->fn_pre = temp->fn_pre;
temp->fn_pre->fn_next = pnew_stu;
temp->fn_pre = pnew_stu;
list->fn_count++;
return;
}
temp = temp->fn_next;
}
if ( temp->fn_next == NULL ) {
temp->fn_next = pnew_stu;
pnew_stu->fn_pre = temp;
pnew_stu->fn_next = NULL;
list->fn_tail = pnew_stu;
list->fn_count++;
return;
}
}
}
}
void add_ln_Node(LIST* list, NODE* pnew_stu) {
NODE* temp = list->ln_head;
if( !(temp = (NODE*) malloc(sizeof(NODE))) ) {
printf("ERROR NOT ENOUGH MEMORY!!!\n");
exit(100);
}
if( list->ln_head == NULL ) {
pnew_stu->ln_next = list->ln_head;
pnew_stu->ln_pre = list->ln_head;
list->ln_head = pnew_stu;
list->ln_count = 1;
return;
}
else {
temp = list->ln_head;
if ( (strcmp( pnew_stu->last_name, temp->last_name )) <= 0 ) {
pnew_stu->ln_next = temp;
pnew_stu->ln_pre = temp->ln_pre;
temp->ln_pre = pnew_stu;
list->ln_head = pnew_stu;
list->ln_count++;
return;
}
else {
while ( temp->ln_next != NULL ) {
if ( (strcmp( pnew_stu->last_name, temp->last_name ) <= 0 ) && (strcmp( pnew_stu->last_name, temp->ln_pre->last_name) > 0)) {
pnew_stu->ln_next = temp;
pnew_stu->ln_pre = temp->ln_pre;
temp->ln_pre->ln_next = pnew_stu;
temp->ln_pre = pnew_stu;
list->ln_count++;
return;
}
temp = temp->ln_next;
}
if ( temp->ln_next == NULL ) {
temp->ln_next = pnew_stu;
pnew_stu->ln_pre = temp;
pnew_stu->ln_next = NULL;
list->ln_tail = pnew_stu;
list->ln_count++;
return;
}
}
}
}
|
|
|
|
|
Are you using C or C++? If the latter, simply use two std::map<const char*, Node*> s as a means to directly access a node by first name and last name respectively. std::map does the sorting for you, and you can just add all new nodes to the head instead of scanning the list. You also won't need to copy the add function for every new 'index' you want your list sorted by.
If you do C only, you still should try to separate the task of storing a list from the task of sorting a list, so you wouldn't need one set of list functions such as adding/removing for every new sorting criterion you want to introduce.
|
|
|
|
|
i am using C i am just only wondering about am i using only one list which have two headers or two lists which the first one is the copy of the other_? and i am adding a node in ascending order(i am using double pointer for print them in descending order )
|
|
|
|
|
Ah, that makes things difficult for me, as I'm not quite sure what is and is not quite possible C.
I'd say use three lists: one just for storing the nodes in an arbitrary order, and two to store your individual sortings, with nodes that only store the key you are using, plus a pointer to the appropriate node in your first list. In the case you describe you can define the node like this:
struct keynode {
const char* key;
struct NODE* node;
}
A more general version that could be used for other types of keys could be:
enum EKeytype { SKEY, IKEY, FKEY };
struct keynode {
EKeytype keytype;
union {
const char* skey;
int ikey;
float fkey;
} key;
struct NODE* node;
}
In this case you need to check for the keytype to properly compare and sort the keys.
The disadvantage of using multiple lists is that youneed to add/remove multiple nodes. The advantage is that you can easily add more sorting criterias. And the code becomes cleaner, because you can seperate the storing from the sorting.
|
|
|
|