|
Thanx David.
I think you did not get my explanation.
CFile::shareDenyxxx works when a file is opened by one instance of an application(file is still open i.e. not closed) and another instance of same application is trying to open the same file.
But in my case as already explained, I open the file, copy the data to application variables and close it. Now I start the second instance of application and try to open the same file(here file is closed by first instance) to copy data to application variables.
How do you restrict the second instance of application to access the same file unless some lock is removed from that file(there should be some way to lock that file)?
Now do you have any solution for this?
Thanks & Regards,
Neeraj
|
|
|
|
|
Neeranjan wrote:
I think you did not get my explanation.
Possibly, but with your revised explanation, the solution should be easier than ever.
Neeranjan wrote:
How do you restrict the second instance of application to access the same file...
At this point, the first instance of the application has closed the file so the file is once again able to be opened by any application, yours included.
If you are not wanting the second instance of the application to be able to open the file, even if the first instance of the application has closed it, you'll either need to have the first instance of the application leave the file open, or since both instances of the application share common code (e.g., the same CDocument object), set up some sort of variable that denotes "in use."
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanx David.
You mean, when a file is closed, there is no way we can restrict that file from accessing by any other application/process.
If it is the case then this will not solve my problem. I have to find some alternative for this.
Thanx David for your help and support.
Will be back with some more queries.
Thanks & Regards,
Neeraj
|
|
|
|
|
Neeranjan wrote:
You mean, when a file is closed, there is no way we can restrict that file from accessing by any other application/process.
Right. When a file is closed, it's closed!
Why is it that you are wanting to keep the second instance of your application from accessing the file?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
If you know the concept of workspace file then it will be easy to understand my explanation as below.
1. When I open a database file from my application, it loads the database file data in to application variables.
2. I perform some operation on the data, stored in application variables.
3. Now here I have two options:
a) I save the application variable data back to the database file.
b) I save the application variable data into a workspace file i.e. an archive file.
Workspace file: Is the copy of memory variables and data stored in variables on to the disk file.
4. Next time when I start the application I will have two options to load the data:
a) Open the database file and load the data in applicaiton variables.
b) Open the workspace file and load the data in applicaiton variables.
Suppose I have started the first instance of application and opened a workspace file(X) i.e. loaded data from workspace file into application variables. ( Here I have to close the file after loading the data, bcoz I will modify data and save data several times and some more things....)
Now I start the second instance of application and load the same workspace file (X).Here I will perform some operation and when I save it then it to workspace it will overwrite the file X even though first instance has modified the data and save back to workspace file X. Thus, here I loose the data saved by the first instance.
I think now you have been understood, why I need to lock a file which is already closed?
Now tell me, is there any solution for this problem?
Thanks & Regards,
Neeraj
|
|
|
|
|
Neeranjan wrote:
If you know the concept of workspace file
The only workspace file I am was familar with is that which is created by Visual Studio. In any case, it's just a file being opened/updated/closed by some application.
From what you've described, the solution, as I see it, is for the first instance to open the file for writing and only allow others read access. Don't close the file, but flush the output buffer after each update. When the second instance comes along, it will read an updated copy of the file.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi y'all. The problem is that the data I try to pass to the web service is received as NULL. Despite my best efforts I have not been able to find a solution to this problem anywhere on the net .
I send the data like this:
* create CInternetSession
* create CHttpConnection
* HttpConnection->OpenRequest(_T("POST"), _T("/CoreContact/WipCoreContact.asmx"),... to get a CHttpFile*
* set headers with pHttpFile->AddRequestHeaders
* finally call pHttpFile->SendRequest(NULL, 0, (LPVOID)((LPCTSTR)strSOAPReq), dwRewLen);
The response SHOULD read "This is your data, " + (parameter data) but the incoming data is always NULL as seen in the vs.net debugger.
This is what I send and get:
HEADERS
Content-Type: text/xml; charset=utf-8
Content-Length:351
SOAPAction: "http://tempuri.org/GetData"
REQUEST
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/en
velope/">
<soap:Body>
<GetData xmlns="http://tempuri.org">
<data>Hey hey service.</data>
</GetData>
</soap:Body>
</soap:Envelope>
RESPONSE
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetDataResponse xmlns="http://tempuri.org/">
<GetDataResult>This is your Data, </GetDataResult>
</GetDataResponse>
</soap:Body>
</soap:Envelope>
----------
Martin
|
|
|
|
|
hi all,
i'm sure it's stupid question but here it is:
how can i convert a floating point to hexa?
if i do this :
float n;
char temp[10];
n=10.0;
sprintf(temp,"%x",n);
and if n is integer than temp is 'A',but if n is float,temp is always 0;
can someone help me?
|
|
|
|
|
http://www.duke.edu/~twf/cps104/floating.html
----------
Martin
|
|
|
|
|
|
Hi everybody, Am in great trouble.
I have a project MyApp.exe which is a big project. It has some 20-30 dll dependencies on it. The resource (including dialog boxes) is in a separate dll. This project had been developed in VC6 previously and has now been ported to .NET. Its running fine.
The thing is, I want to make the dialog boxes appear with the Windows XP visual style. So, when an user selects Windows XP style from Control Panel->Appearance tab, the appearance of the dialogs should change too. It must not have the classic style appearance.
For this, I have followed the methods outlined in MSDN site. I am giving the links too.
1) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/xptheming.asp
2) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/cookbook.asp
Th process given above works fine for a simple dialog-based project.
But, where, even the resource is in a separate dll, there, it doesn't work.
PLEASE DO GIVE ME ANY FEEDBACK OR SUGGESTIONS ASAP.
Thanks and Regards,
Anind
|
|
|
|
|
Hi,
I want to add IP address programatically. Any idea how can I do this. I know of one function AddIPAddress, but it is for IPv4. Thanks for help.
Regards
Alpha
|
|
|
|
|
Hi, My questions deals with Template Functions.
I am suppose to code these functions and write a driver program to test them with various types of arrarys. Each templated function should work on any size array of any type.
<b>sortArrary</b> to sort an array in ascending order (using < comparison) <b>NOTE: I must pass the array and its size. I can use either a selection sort or an insertion sort. </b>
<b>searchArry </b> to look for a target element in a given arrary and return the locations or -1 if the target is not found. This is to be a binary search. <b>NOTE: I must pass in a <i>sorted</i> array, its size, and the target element</b>.
<b>deleteItem</b> to delete an item from an arrary. <b>NOTE: I have to pass in an arrary, its size, and the targe5t to be deleted. I must pass in a <i>sorted</i> array, its size, and the target element</b>.
I am having trouble writing these functions....
Thanks alot...Jason
|
|
|
|
|
This looks like a homework assignment, so I won't give you a ready solution, but will point out a few steps that will help you forward.
Templated functions are declared as follows:
template<typename Type>
void sortArray(Type* ptrArray, unsigned int nSize); This is a declaration of a templated function that takes a pointer to the first cell of the array, and the size of the array. To pass a whole array, change the first parameter to Type tgtArray[] .
The key is to first write a function that does the job for, say, an array of integers. Then, by interpreting and understanding the above declaration, you can easily change the function to support any type that has comparison operators (< and >) defined. This includes all basic types (int, char, float, double etc)
Hope this helps
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi all !
I read a code which contained a #pragma key. I researched in MSDN lib but can't understand detail it. Can you explain me about this keyword ? thank alot.
example: #pragma abc
hanhquang
|
|
|
|
|
There are defined pragma , you need to give exact code you read there.
#pragma abc is not valid pragma option.
|
|
|
|
|
//statement 1 (embed ASM)
#pragma asm
_CPU_WDTMR .equ 0060h
push.l er2 ;
mov.w #10000,e2 ; /* 48 * 10000 state */
_wt100_0:
mov.w #h'0ff,r2 ; /* 2-state */
mov.w #h'0ff,r2 ; /* 2-state */
mov.b r2l,@(_CPU_WDTMR:32) ; /* 5-state */
mov.b r2l,@(_CPU_WDTMR:32) ; /* 5-state */
mov.b r2l,@(_CPU_WDTMR:32) ; /* 5-state */
mov.b r2l,@(_CPU_WDTMR:32) ; /* 5-state */
mov.b r2l,@(_CPU_WDTMR:32) ; /* 5-state */
mov.b r2l,@(_CPU_WDTMR:32) ; /* 5-state */
mov.b r2l,@(_CPU_WDTMR:32) ; /* 5-state */
mov.b r2l,@(_CPU_WDTMR:32) ; /* 5-state */
dec.w #1,e2 ; /* 1-state */
bne _wt100_0 ; /* 3-state */
pop.l er2 ;
#pragma endasm
// statement 2:
#pragma SYN_SFSLCT (*(volatile u_char *)0x200402)
Above, It's two statement relate to #pragma. Please explain clearly to help me. thank alot
hanhquang
|
|
|
|
|
In Simple terms it is used to set compiler options.
Regards
Alpha
|
|
|
|
|
All,
I need to implement a circular linked list of circular linked lists. I can generate the individual linked lists just fine but can't quite figure out how to link the lists together. My node has pointers to a right node and a down node. So, a list would be node->right to node->right etc, but I can't figure out how to link a list using the down pointer without loosing the pointer to the first node. Any advice?
Thanks in advance (and I hope this makes sense...)
John
|
|
|
|
|
The solution is to think in 3D.
First, consider that you have a circle of cells. This represents the top level linked list. Each cell contains an index number (integer) and a pointer to the next node of the circle. This linked list is called 'primary list'.
Now, enhance each of these cells so that they also contain a second pointer. Each of these cells becomes the first cell of a secondary linked list that rotates from the 2D plane up, does a circle, and returns down again. The second pointer points to the next cell of the secondary linked list.
Here is a declaration of the cell structure
struct Node {
int nNumber;
element_type* ptrNext;
element_type* ptrDown;
}; The primary linked list has valid values in all entries. ptrNext points to the next cell in the primary list, and ptrDown points to the next cell in the secondary list. The secondary list has two types of cells:
a) Members of the primary and secondary lists, with valid values in all entires
b) Members of the secondary list only, with a NULL value in ptrNext
In the primary list, the nNumber entry contains an index number that identifies an individual list from the chain, e.g. list at index position 1. In order to keep it simple, you could use negative values in the primary chain, and positive values in secondary chains. This would make it easy to identify any given cell: if it's value is negative, it's the linking cell between a secondary and a primary list. If it's positive, it's an individual cell in some secondary list.
If the above was implemented, then those cells with negative values would be the headers of the secondary lists, as stated in ADT language. The primary linked list might also have a header. This header's ptrDown value should be NULL, or index value should be 0, to seperate it from the other members of the primary list and the members of the secondary lists.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I'm trying ot write a IRC program and I've hit a snag. Getting the string into pieces is tough for me, I've tried strtok, memcopy, copymemory, all that crap and I just can't seem to get it right, the program just crashes.
This is basicly what I need to parse:
:Nick!Stuff@=HostOrSomething.eggormuffin PRIVMSG #channel :hi\r\n
I need to get it into:
Nick
PRIVMSG
#channel
hi
If you could give me some advice, some code, or an article I would greatly appreciate it
wWw.KruncherInc.cOm
|
|
|
|
|
Why dont u write your own parsing function.
Imagine that you are creating a fabric of human destiny with the object of making men happy in the end, giving them peace and rest at last, but that it was essential and inevitable to torture to death only one tiny creature..and to found that edifice on its unavenged tears, would you consent to be the architect on those conditions? Tell me, and tell me the truth!
-Fyodor Dostoevsky, The Brothers Karamazov
|
|
|
|
|
What's wrong with:
CString strSource = ":Nick!Stuff@=HostOrSomething.eggormuffin PRIVMSG #channel :hi\r\n",
str1,
str2,
str3,
str4;
AfxExtractSubString(str1, strSource, 0, '!');
AfxExtractSubString(str2, strSource, 1, ' ');
AfxExtractSubString(str3, strSource, 2, ' ');
AfxExtractSubString(str4, strSource, 2, ':');
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Because I am using WIN32 API, no MFC.
wWw.KruncherInc.cOm
|
|
|
|
|
Technically, MFC is also using the WIN32 API, but your point is taken nonetheless. I like to say that an apple is a fruit, but a fruit is not an apple.
Try this for starters:
LPCSTR lpszSource = ":Nick!Stuff@=HostOrSomething.eggormuffin PRIVMSG #channel :hi\r\n",
lpszPtr;
TCHAR szStr1[32],
szStr2[32],
szStr3[32],
szStr4[32];
lpszPtr = strchr(lpszSource, '!');
lstrcpyn(szStr1, lpszSource, lpszPtr - lpszSource + 1);
lpszSource = lpszPtr + 1;
lpszPtr = strchr(lpszSource, ' ');
lpszSource = lpszPtr + 1;
lpszPtr = strchr(lpszSource, ' ');
lstrcpyn(szStr2, lpszSource, lpszPtr - lpszSource + 1);
lpszSource = lpszPtr + 1;
lpszPtr = strchr(lpszSource, ' ');
lstrcpyn(szStr3, lpszSource, lpszPtr - lpszSource + 1);
lpszSource = lpszPtr + 2;
lpszPtr = strchr(lpszSource, '\r');
lstrcpyn(szStr4, lpszSource, lpszPtr - lpszSource + 1);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|